Hi all, Thanks, the problem is solved, here is the link http://stackoverflow.com/questions/11740362/merge-two-bitmaps-in-android
On Wed, Aug 1, 2012 at 6:55 PM, bob <[email protected]> wrote: > Look at line 263 in AndroidCamera.java. > > Something is null there that shouldn't be. > > We don't know which line of yours is 263. > > On Tuesday, July 31, 2012 5:52:27 PM UTC-5, Numair Qadir wrote: >> >> With the help of "pro Android.Media", i tried, but it gave me force close >> error, here is my code and logcat >> >> // Camera arg conversion to Bitmap >> Bitmap cameraBitmap = BitmapFactory.decodeByteArray(**arg0, 0, >> arg0.length); >> Bitmap back = Bitmap.createBitmap(**cameraBitmap.getWidth(), >> cameraBitmap.getHeight(), Bitmap.Config.ARGB_8888); >> Canvas cam = new Canvas(back); >> cam.drawBitmap(cameraBitmap, matrix, null); >> // FrameLayout to Bitmap >> FrameLayout mainLayout = (FrameLayout) findViewById(R.id.frame); >> Bitmap foreground = Bitmap.createBitmap(**mainLayout.getWidth(), >> mainLayout.getHeight(), Bitmap.Config.ARGB_8888); >> Canvas c = new Canvas(foreground); >> mainLayout.draw(c); >> Bitmap cs = Bitmap.createBitmap(**cameraBitmap.getWidth(), >> cameraBitmap.getHeight(), Bitmap.Config.ARGB_8888); >> Canvas canvas = new Canvas(cs); >> Paint paint = new Paint(); >> canvas.drawBitmap(**cameraBitmap, 0, 0, paint); >> paint.setXfermode(new PorterDuffXfermode(android.** >> graphics.PorterDuff.Mode.**MULTIPLY)); >> canvas.drawBitmap(foreground, 0, 0, paint); >> view.setImageBitmap(cs); >> >> >> and log cat >> >> 08-01 04:46:07.969: E/AndroidRuntime(737): FATAL EXCEPTION: main >> 08-01 04:46:07.969: E/AndroidRuntime(737): java.lang.NullPointerException >> 08-01 04:46:07.969: E/AndroidRuntime(737): at com.exercise.AndroidCamera. >> **AndroidCamera$4.**onPictureTaken(AndroidCamera.**java:263) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at android.hardware.Camera$** >> EventHandler.handleMessage(**Camera.java:320) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at android.os.Handler.** >> dispatchMessage(Handler.java:**99) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at >> android.os.Looper.loop(Looper.**java:123) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at android.app.ActivityThread. >> **main(ActivityThread.java:4627) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at >> java.lang.reflect.Method.**invokeNative(Native >> Method) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at java.lang.reflect.Method.** >> invoke(Method.java:521) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at com.android.internal.os.** >> ZygoteInit$**MethodAndArgsCaller.run(**ZygoteInit.java:868) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at com.android.internal.os.** >> ZygoteInit.main(ZygoteInit.**java:626) >> 08-01 04:46:07.969: E/AndroidRuntime(737): at dalvik.system.NativeStart.* >> *main(Native Method) >> >> Can you please help me to figure out the issue? Thanks >> >> On Tue, Jul 31, 2012 at 8:44 PM, Jim Graham <[email protected]> wrote: >> >>> On Tue, Jul 31, 2012 at 05:57:47AM -0700, Numair Qadir wrote: >>> > I want to merge two bitmaps, here is my code >>> >>> I was just going to point you to the right page in the dev guide, but I >>> don't remember if there even is one (I learned this from a book, "Pro >>> Android Media"). Be advised that with larger bitmaps, you can easily >>> cause an Out Of Memory error and, if that isn't caught, a force close, >>> so if you need to do this with LARGE bitmaps, you'll have to use the NDK. >>> >>> // blend src1 and src2 into dest (must be same size and, I think they >>> // have to be the same configuration, too, e.g., both ARGB_8888) >>> >>> Bitmap dest = Bitmap.createBitmap(width, height, src1.getConfig()); >>> Canvas canvas = new Canvas(src2); >>> Paint paint = new Paint(); >>> >>> canvas = new Canvas(src2); >>> paint = new Paint(); >>> canvas.drawBitmap(src1, 0, 0, paint); >>> paint.setXfermode(new PorterDuffXfermode(android.** >>> graphics.PorterDuff.Mode.SRC_**OVER)); >>> canvas.drawBitmap(dest, 0, 0, paint); >>> >>> PorterDuff has quite a few different modes, so check out the dev guide's >>> page on PorterDuff.Mode for more information. >>> >>> Later, >>> --jim >>> >>> -- >>> THE SCORE: ME: 2 CANCER: 0 >>> 73 DE N5IAL (/4) MiSTie #49997 < Running Mac OS X Lion > >>> [email protected] ICBM/Hurricane: 30.44406N 86.59909W >>> >>> "'Wrong' is one of those concepts that depends on witnesses." >>> --Catbert: Evil Director of Human Resources (Dilbert, 05Nov09) >>> >>> Android Apps Listing at >>> http://www.jstrack.org/**barcodes.html<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 android-developers@** >>> googlegroups.com <[email protected]> >>> To unsubscribe from this group, send email to >>> android-developers+**[email protected]<android-developers%[email protected]> >>> For more options, visit this group at >>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>> >> >> -- > 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 > -- 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

