Apart from bmp, try checking if the imageView itself is null. Perhaps you forgot to assign an ImageView to it earlier on. I did that once, got an NPE that had my going crazy for days.
Thanks On Mon, Feb 13, 2012 at 7:53 PM, Jim Graham <[email protected]> wrote: > On Mon, Feb 13, 2012 at 05:14:50PM +0400, Kostya Vasilyev wrote: > > Does the call to Bitmap.create() return a non-null object in the first > > place? If it returns null, have you tried RGB_565, just as a test? > > Ok, I wrapped everything after the call to Bitmap.create up to and > including loading bmp into the imageView in an > if {bmp != null) { > } > > and it still forced closes. I then commented it all out...no force > close. logcat says the NULL exception is happening (caused by) loading > bmp into the imageView. But in this case, it didn't even get that far. > > > An ALPHA_8 bitmap would use one quarter the amount of memory of an > > ARGB_8888 bitmap. > > Ahhhh, ok...I misread the description. I thought the dev guide was > saying that an ALPHA_8 bitmap was just a bunch of alpha values (yeah, > kind of a stupid interpretation, now that I look back at it <grin>). > Yes, I agree...that is definitely the right choice. I'll uncomment > everything and see how that works. And here are the results...and this > time, instead of summarizing the logcat output, I'm just posting it: > > --------------------------- CUT HERE --------------------------- > > D Shutting down VM > W threadid=1: thread exiting with uncaught exception (group=0x401f9760) > E FATAL EXCEPTION: main > E java.lang.RuntimeException: Unable to start activity > > ComponentInfo{com.jdgapps.demo/com.jdgapps.demo. > DemoCameraFiltersActivity}: > java.lang.NullPointerException > E > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815) > E > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831) > E android.app.ActivityThread.access$500(ActivityThread.java:122) > E android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024) > E android.os.Handler.dispatchMessage(Handler.java:99) > E android.os.Looper.loop(Looper.java:132) > E android.app.ActivityThread.main(ActivityThread.java:4123) > E java.lang.reflect.Method.invokeNative(Native Method) > E java.lang.reflect.Method.invoke(Method.java:491) > E > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) > E com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) > E dalvik.system.NativeStart.main(Native Method) > E Caused by: java.lang.NullPointerException > E com.jdgapps.demo.DemoCameraFiltersActivity.onCreate > (DemoCameraFiltersActivity.java:43) > E android.app.Activity.performCreate(Activity.java:4397) > E > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) > E > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779) > > Force finishing activity com.jdgapps.demo/.DemoCameraFiltersActivity > > --------------------------- CUT HERE --------------------------- > > And this is the code block that's failing: > > --------------------------- CUT HERE --------------------------- > > Bitmap bmp = Bitmap.createBitmap(4, 3, Bitmap.Config.ALPHA_8); > if (bmp != null) { > Canvas mcanvas = new Canvas(bmp); > Paint paint = new Paint(); > mcanvas.drawBitmap(bmp, 0, 0, paint); > paint.setColor(0x280000); > Matrix matrix = new Matrix(); > matrix.setValues(new float[] { > 1, 0, 0, > 0, 1, 0, > 0, 0, 1 > }); > mcanvas.drawBitmap(bmp, matrix, paint); > imageView.setImageBitmap(bmp); // this is line 43, where it dies > } > > --------------------------- CUT HERE --------------------------- > > Any suggestions? > > Thanks, > --jim > > -- > THE SCORE: ME: 2 CANCER: 0 > 73 DE N5IAL (/4) MiSTie #49997 < Running FreeBSD 7.0 > > [email protected] ICBM/Hurr.: 30.44406N 86.59909W > > "The iPad is a status symbol for yuppies. The Android > is for people who actually want something that works." > > Android Apps Listing at http://www.jstrack.org/barcodes.html > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Raghav Sood http://www.androidactivist.org/ - Author http://www.appaholics.in/ - Founder -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

