Yes, you are creating a drawing cache that the system has decided is
too large. In such a situation, the returned drawing cache is null.
You have to account for this.

On Tue, Jan 13, 2009 at 5:34 PM, srajpal <[email protected]> wrote:
>
>
>
> I am having an issue when trying to save a screen shot of a view to a
> file.
>
> I am using the following code to save the bitmap
>
> Java:
>
>
> Bitmap screenshot;
>
> mView.setDrawingCacheEnabled(true);
> screenshot = Bitmap.createBitmap(mView.getDrawingCache());
> mView.setDrawingCacheEnabled(false);
>
> try {
>       FileOutputStream fos = new FileOutputStream("/sdcard/
> test.png");
>     screenshot.compress(Bitmap.CompressFormat.PNG, 100, fos);
>     fos.close();
> } catch (FileNotFoundException e) {
>     Log.d("FileNotFoundException: " + e.getMessage());
> } catch (IOException e) {
>     Log.d("IOException: " + e.getMessage());
> }
>
>
> it works fine unless i put the following in my onCreate() to make sure
> I am in full screen mode
>
> Java:
>
> getWindow().setFlags
> (WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
>
>
>
> when that code is in there I get a NullPointerException at createBitmap
> ()
> does anybody know why this would be happening?
> _________________
> --
> Sunny
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to