I am not sure I understand, can you please elaberate? I am drawing into a bitmap using the DrawingCache which should be a bitmap, the view has a canvas already. So I am a little confused.
Can you explain? On Jan 14, 3:31 pm, Romain Guy <[email protected]> wrote: > The problem is the size of the View you are trying to capture. The > view is too big. What you can do however is draw the View in a Canvas > attached to your own Bitmap. > > > > On Wed, Jan 14, 2009 at 12:29 PM, srajpal <[email protected]> wrote: > > > but i get the same error if i just pick a potion of the screen > > > screenshot = Bitmap.createBitmap(mView.getDrawingCache(), > > 100,100,100,100); > > > or try to pass it exact size > > > screenshot = Bitmap.createBitmap(mView.getDrawingCache(), > > mView.getLeft(), mView.getTop(), > > mView.getMeasuredWidth(), mView.getMeasuredHeight()); > > > any suggestions? > > > On Jan 14, 1:25 am, Romain Guy <[email protected]> wrote: > >> 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 > > -- > 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 -~----------~----~----~----~------~----~------~--~---

