If somebody knows this, plz help me

- AJ

On Sep 9, 1:26 pm, Ajeet Singh <ajeet.invinci...@gmail.com> wrote:
> Hi gjs,
>
> Thanks for pointing that error. But that was a type error. Now I am
> pasting the correct code here.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>        WebVieww = newWebView(this);
>         w.loadUrl("http://www.yahoo.com";);
>        BitmapmBitmap          = null;
>         ByteArrayOutputStream mByteArrayOpStream        = null;
>
>         //get the picture from thewebview
>         Picture picture = w.capturePicture();
>
>         //Create the new Canvas
>         Canvas mCanvas = new Canvas();
>
>         //Copy the view canvas to abitmap
>         try{
>                 //w.draw(mCanvas);
>                 //mCanvas.save();
>                 //picture.draw(mCanvas);
>                 mCanvas.drawPicture(picture);
>                 //int restoreToCount =mCanvas.save();
>                 //mCanvas.drawPicture(picture);
>                 //mCanvas.restore();
>         }
>         catch (Exception e) {
>                 e.printStackTrace();
>         }
>
>         mBitmap =Bitmap.createBitmap(w.getWidth(), w.getHeight
> (),Config.ARGB_8888);
>         mCanvas.drawBitmap(mBitmap, 0, 0, null);
>
>         if(mBitmap!= null) {
>                 mByteArrayOpStream = new ByteArrayOutputStream();
>                 mBitmap.compress(Bitmap.CompressFormat.JPEG, 90,
> mByteArrayOpStream);
>                 try {
>                         fos = openFileOutput("yahoo.jpg", 
> MODE_WORLD_WRITEABLE);
>                         fos.write(mByteArrayOpStream.toByteArray());
>                         fos.close();
>                 } catch (FileNotFoundException e) {
>                         e.printStackTrace();
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 }
>         }
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Thanks,
> Ajeet Singh
>
> On Sep 9, 12:29 pm, gjs <garyjamessi...@gmail.com> wrote:
>
> > Hi,
>
> > the code you posted refers to mBitmapScreenshotonce, how did you
> > instantiate this, what is itcontent? black maybe...
>
> > your code also refers to screenshot but the only time you access is
> > when you attempt to compress itintoa byte array, what is it
> >content? black maybe...
>
> > Regards
>
> > PS you won't get much help here, if you can't be bothered to check
> > your own code...
>
> > On Sep 9, 4:40 pm, Ajeet Singh <ajeet.invinci...@gmail.com> wrote:
>
> > > Hi All,
>
> > > I am trying to get thewebview'scontenton abitmapso that i can
> > > save it as a image. But I am unable to so. I am getting the BLACK
> > > image save instead. Allcontentis missing :(
>
> > > Anybody can help me regarding this.
>
> > > Here is my code
>
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > > //create awebview
> > >WebVieww = newWebView(this);
>
> > > //Loads the url
> > > w.loadUrl("http://www.yahoo.com";);
>
> > > //After loading completely, take its picture
> > > Picture picture = w.capturePicture();
>
> > > //Create a new canvas
> > > Canvas mCanvas = new Canvas();
>
> > > //Draw the Pictureintothe Canvas
> > > picture.draw(mCanvas);
>
> > > //Create aBitmap
> > >Bitmapsreenshot =Bitmap.createBitmap(picture.getWidth(),
> > > picture.getHeight(),Config.ARGB_8888);
>
> > > //copy thecontentfron Canvas toBitmap
> > > mCanvas.drawBitmap(mBitmapScreenshot, 0, 0, null);
>
> > > //Save theBitmapto local filesystem
> > > if(sreenshot != null) {
> > >         ByteArrayOutputStream mByteArrayOpStream = new
> > > ByteArrayOutputStream();
> > >         screenshot.compress(Bitmap.CompressFormat.JPEG, 90,
> > > mByteArrayOpStream);
> > >         try {
> > >                 fos = openFileOutput("yahoo.jpg",
> > > MODE_WORLD_WRITEABLE);
> > >                 fos.write(mByteArrayOpStream.toByteArray());
> > >                 fos.close();
> > >         } catch (FileNotFoundException e) {
> > >                 e.printStackTrace();
> > >         } catch (IOException e) {
> > >                 e.printStackTrace();
> > >         }
>
> > > }
>
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > > Thanks,
> > > AJ
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to