Android Canvas - Save Image not working?

You can use drawing cache of view to save image first enable drawingcache of you view by myPanel. SetDrawingCacheEnabled(true) after that in your saveImage function write following code Bitmap bitMap=v. GetDrawingCache(true); if (!APP_FILE_PATH.exists()) { APP_FILE_PATH.mkdirs(); } bitMap.

Compress(Bitmap.CompressFormat. PNG, 95, f).

You can use drawing cache of view to save image first enable drawingcache of you view by myPanel. SetDrawingCacheEnabled(true); after that in your saveImage function write following code Bitmap bitMap=v. GetDrawingCache(true); if (!APP_FILE_PATH.exists()) { APP_FILE_PATH.mkdirs(); } bitMap.

Compress(Bitmap.CompressFormat. PNG, 95, f).

Thanks for that, sadly I'm getting a NullPointerException on the last line. Does that mean the cache is empty? – Atkobeau Mar 31 at 14:23 can you paste you logcat exception detail – Sunil Pandey Mar 31 at 14:25 java.lang.

NullPointerException com.ebp.Panel. SaveAsJpg(ebpSeatingPlan. Java:121) com.ebp.ebpSeatingPlan.

OnOptionsItemSelected(ebpSeatingPlan. Java:80) android.app.Activity. OnMenuItemSelected(Activity.

Java:2200) com.android.internal.policy.impl.PhoneWindow. OnMenuItemSelected(PhoneWindow. Java?

:730) com.android.internal.view.menu.MenuItemImpl. Invoke(MenuItemImpl. Java:139) com.android.internal.view.menu.MenuBuilder.

PerformItemAction(MenuBuilder. Java:85?5) com.android.internal.view.menu.IconMenuView. InvokeItem(IconMenuView.

Java:525) – Atkobeau Mar 31 at 14:57 com.android.internal.view.menu. IconMenuItemView. PerformClick(IconMenuItemView.

Ja? Va:129) android.view.View. OnTouchEvent(View.

Java:4185) android.widget.TextView. OnTouchEvent(TextView. Java:6786) android.view.View.

DispatchTouchEvent(View. Java:3715) android.view.ViewGroup. DispatchTouchEvent(ViewGroup.

Java:884) android.view.ViewGroup. DispatchTouchEvent(ViewGroup. Java:884) com.android.internal.policy.impl.

PhoneWindow$DecorView. DispatchTouchEvent(PhoneW?indow. Java:1643) android.view.ViewRoot.

HandleMessage(ViewRoot. Java:1728) android.os.Handler. DispatchMessage(Handler.

Java:99) – Atkobeau Mar 31 at 14:58 android.os.Looper. Loop(Looper. Java:214) android.app.ActivityThread.

Main(ActivityThread. Java:4415) java.lang.reflect.Method. InvokeNative(Native Method) java.lang.reflect.Method.

Invoke(Method. Java:521) com.android.internal.os. ZygoteInit$MethodAndArgsCaller.

Run(ZygoteInit. Java:868) com.android.internal.os.ZygoteInit. Main(ZygoteInit.

Java:626) dalvik.system.NativeStart. Main(Native Method) – Atkobeau Mar 31 at 14:58.

String fname = "image"+now.getDate()+now.getSeconds()+". Class Panel extends SurfaceView implements SurfaceHolder. Bitmap be = Bitmap.

MakeText(super.getContext(),"Image Saved", Toast. MakeText(super.getContext(),"Error Saving Image", Toast. If (event.getAction() == MotionEvent.

Graphic = new GraphicObject(BitmapFactory.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions