Hey everybody!
picture = w.capturePicture(); // w is the webview int hpp = 1200; int
page = 1 + height /hpp; Bitmap  b; if(page == 1) {
     b = Bitmap.createBitmap( width, height, Bitmap.Config.RGB_565);
     Canvas c = new Canvas( b );
     picture.draw( c );

     String path = folder + "web1.jpg";
     if(SaveBitmap(path, b))
     {
        list.add(path);
     }
}
else
{
     b = Bitmap.createBitmap( width, hpp, Bitmap.Config.RGB_565);

     Canvas c = new Canvas( b );
     String path;

     for(int i = 1;i<page;i++)
      {
                picture.draw( c );

        path = folder + "web" + i+".jpg";
        if(SaveBitmap(path, b))
        {
                list.add(path);
        }
        c.translate(0, -hpp);
       }

       b.recycle();

                //save the last part of the web
        int last = height - hpp*(page -1);

        b = Bitmap.createBitmap( width, hpp, Bitmap.Config.RGB_565);
                b.eraseColor(Color.WHITE);
        c = new Canvas(b);

        c.translate(0, -hpp*(page-1));
        picture.draw( c );

        path = folder + "web" + page+".jpg";
        if(SaveBitmap(path, b))
        {
                list.add(path);

        }
}

This code capture a webview to picture and divid into several files .
I can use this when click a button,but when i try to do this in a
thread (for showing a progress dialog while long time saving file to
user),the first file lost some image and characters but the last file
is right.
WHY?
Some one has any ideas?

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to