Thanks, sean for the quick reply.
I did not get what exactly you want to say.(Sorry for that)
Let me explain what i am trying to do.
################################### Code START
###################################
// I have created one webview
WebView w = new WebView(this);
//Loaded yahoo
w.loadUrl("http://www.yahoo.com");
//Capture the picture
Picture picture = w.capturePicture();
int mHeight = picture.getHeight();
int mWidth = picture.getWidth();
// created the Bitmap
Bitmap bmpBuffer = Bitmap.createBitmap(mWidth, mHeight,
Config.ARGB_8888);
if(bmpBuffer != null) {
mByteArrayOpStream = new ByteArrayOutputStream();
bmpBuffer.compress(Bitmap.CompressFormat.JPEG, 90,
mByteArrayOpStream);
fos = openFileOutput("yahoo.jpg", MODE_WORLD_WRITEABLE);
fos.write(mByteArrayOpStream.toByteArray());
fos.close();
}
################################### Code END
###################################
But when I see my image (yahoo.jpg) its an empty image. Nothing is
there.
After that i tried another method. there is one function
getDrawingCache() which returns the Bitmap. But it is returning the
Bitmap only of the visible area of the screen. (NOT the whole webpage)
Any help would be appreciated.
Thanks in Advance,
Ajeet Singh
On Sep 7, 1:42 pm, Sean Hodges <[email protected]> wrote:
> I've not done this before, but I believe you could create a new Canvas
> object, and call the draw() method on your parent activity, passing in
> your temp canvas object as the target:
>
> http://developer.android.com/reference/android/view/View.html#draw%28...
>
> Something similar to this:
>
> Canvas tempCanvas = new Canvas();
> this.draw(tempCanvas);
> Bitmap screenshot = tempCanvas.drawBitmap(...)
>
> After that, you should be able to call drawBitmap() on the canvas,
> and it will produce a "screenshiot" of everything inside that
> activity.
>
> On Mon, Sep 7, 2009 at 9:29 AM, Ajeet Singh<[email protected]> wrote:
>
> > Actually I want to take screen-shot of what is shown on the screen as
> > well as beyond it also like in case if scroll bar are present.
>
> > There is one function getDrawingCache() which does that, but it only
> > save picture what is available on the screen. It does not capture
> > beyond screen if the picture is big.
>
> > If some body knows then plz reply.
>
> > Anyway, i will post this question to android-developer forum.
>
> > Thanks gjs for your quick reply.
>
> > Ajeet
>
> > On Sep 7, 12:22 pm, gjs <[email protected]> wrote:
> >> And this question is probably better asked in the developers group.
>
> >>http://groups.google.com/group/android-developers
>
> >> On Sep 7, 5:11 pm, gjs <[email protected]> wrote:
>
> >> > Hi,
>
> >> > Have a look at View.draw(Canvas canvas) in the
> >> > docshttp://developer.android.com/reference/android/view/View.html
>
> >> > Create a Bitmap of an appropriate size and a Canvas which uses the
> >> > Bitmap, call View.draw(canvas) - using your view - then save the
> >> > Bitmap to file in whatever format jpg, png etc.
>
> >> > It works for most but not all types of views.
>
> >> > Regards
>
> >> > On Sep 7, 2:42 pm, Ajeet Singh <[email protected]> wrote:
>
> >> > > I want to use screenshot kind of application in my own application. So
> >> > > that I can take picture in any format and save it.
>
> >> > > Can anybody give me hint what to use and how to start?
>
> >> > > Thanks in advance,
> >> > > Ajeet
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Discuss" 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-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---