[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread srajpal
That worked perfectly, here is the final code that saves the screenshot as a file: //mView is my View Bitmap screenBMP = Bitmap.createBitmap(mView.getMeasuredWidth(), mView.getMeasuredHeight(), Bitmap.Config.RGB_565); Canvas screenShotCanvas = new Canvas(screenBMP); mView.draw(screenShot

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread srajpal
That worked perfectly, here is the final code that saves the screenshot as a file: //mView is my View Bitmap screenBMP = Bitmap.createBitmap(mView.getMeasuredWidth(), mView.getMeasuredHeight(), Bitmap.Config.RGB_565); Canvas screenShotCanvas = new Canvas(screenBMP); mView.draw(screenShot

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread James Yum
Hi, Try something like this: 1. Create a new bitmap with the same dimensions as the view. 2. Create a new canvas for that bitmap, e.g.: Canvas screenshotCanvas = new Canvas(screenshotBitmap); 3. Draw onto the canvas: view.draw(screenshotCanvas); Cheers, James On Wed, Jan 14, 2009 at 12:

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread srajpal
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 wrote: > The problem is the size of the View you are tr

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread srajpal
I thought I was drawing the View into the Bitmap with screenshot = Bitmap.createBitmap(mView.getDrawingCache()); or screenshot = Bitmap.createBitmap(mView.getDrawingCache(), mView.getLeft(), mView.getTop(), mView.getMeasuredWidth(), mView.getMeasuredHeight()); Is

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread James Yum
Just checking, have you thought about drawing the view into a Bitmap? Cheers, James On Wed, Jan 14, 2009 at 12:29 PM, srajpal 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

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread Romain Guy
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 wrote: > > but i get the same error if i just pick a potion of the screen > > screenshot

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-14 Thread srajpal
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(), mVi

[android-developers] Re: Please help: CreateBitmap() is null when full screen is enabled

2009-01-13 Thread Romain Guy
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 wrote: > > > > I am having an issue when trying to save a screen shot of a view to a > f