Capturing whatever is drawn in the view...

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Capturing whatever is drawn in the view...

Postby Monu » Wed Oct 28, 2009 1:32 pm

I am trying to take a screen shot of whatever is drawn on my custom
view's canvas. I use the following lines for the same:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. //enable drawing cache
  2.  
  3. this.setDrawingCacheEnabled(true);
  4.  
  5. // use the drawing on the cache to create a Bitmap Object
  6.  
  7. Bitmap screenshot = this.getDrawingCache();
  8.  
  9. // disable the cache
  10.  
  11. this.setDrawingCacheEnabled(false);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Note: My custom view just draws two Bitmaps one above the another(sort of an Overlay).


Problem:


The getDrawingCache() call returns null sometimes. Also, when teh call does return a valid bitmap, the bitmap object returns true on isRecycled() test.

Any pointers to what I am doing wrong here?


Thanks.
Monu
Freshman
Freshman
 
Posts: 8
Joined: Thu Jan 08, 2009 7:33 am

Top

Postby Monu » Thu Oct 29, 2009 7:21 am

found solution :here
AND here
Monu
Freshman
Freshman
 
Posts: 8
Joined: Thu Jan 08, 2009 7:33 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests