android - Persisting Bitmap When Activity Ends -


android experts, need help. i'm android noob. have application need draw bitmap using canvas outside main ui thread. stumbled onto surfaceview class , mocked quick demo. created seperate bitmap instance , draw it. when ondraw surfaceview occurs, copy bitmap surfaceview. works great until activity ends by, example, going home screen. @ point, surfaceview thread seems stop, , seem lose bitmap image working on. when return app, starts on scratch.

i create bitmap image using canvas 2d drawing calls thread seperate main ui thread performance reasons. need bitmap main user interface once in awhile. , need bitmap image retained , continue drawn (to keep current) when activity paused or stopped.

since must drawing in main ui thread surfaceview seems solution. doesn't quite work hoped either.

i need background task or thread never stops running , need create bitmap image there, , need bitmap main user interface once in awhile (say 10 hz updates).

help! how do this?

use asynctask draw image onto ui.

however, canvas needs redrawn when app re-opened. if want save bitmap created need store somewhere. think can handled using caching:

view.setdrawingcacheenabled(true); 

else managing bitmap yourself:

v1.setdrawingcacheenabled(true);  bitmap = bitmap.createbitmap(v1.getdrawingcache()); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -