android - Emulator crashing (NullPointerException) only on one computer when calling imageView.getDrawable() -
when run app on emulator on 1 of laptops, returns null imageview.getdrawable()
if run same app/code on laptop's emulator, runs without issue , if run on actual device, runs without issue.
this code:
if ( !(imageview.getdrawable() instanceof bitmapdrawable)) return; //clean free memory bitmapdrawable bitmapdrawable = (bitmapdrawable)imageview.getdrawable(); //this throws null pointer (which means above line returned null) bitmapdrawable.getbitmap().recycle();
throws this:
java.lang.nullpointerexception @ com.bignerdranch.android.criminalintent.pictureutils.cleanimageview(pictureutils.java:54) @ com.bignerdranch.android.criminalintent.crimefragment.onstop(crimefragment.java:251) @ android.support.v4.app.fragment.performstop(fragment.java:1677) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:994) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1121) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1103) @ android.support.v4.app.fragmentmanagerimpl.dispatchstop(fragmentmanager.java:1924) @ android.support.v4.app.fragmentactivity.onstop(fragmentactivity.java:613) @ android.app.instrumentation.callactivityonstop(instrumentation.java:1212) @ android.app.activity.performstop(activity.java:5376) @ android.app.activitythread.performstopactivityinner(activitythread.java:3185) @ android.app.activitythread.handlestopactivity(activitythread.java:3234) @ android.app.activitythread.access$1100(activitythread.java:135) @ android.app.activitythread$h.handlemessage(activitythread.java:1223) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) @ dalvik.system.nativestart.main(native method)
how figure out why happens on computer only? here's computers/devices:
working devices
acer c720 chromebook (chrubuntu linux), 4gb ram, nexus 5 emulator
nexus 9 tablet
non-working device (throws nullpointerexception)
samsung series 9 (opensuse linux), 8gb ram, nexus 5 emulator
Comments
Post a Comment