Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:10:07+00:00 2026-06-12T18:10:07+00:00

ok so im trying capture the webview on button click, of the web page

  • 0

ok so im trying capture the webview on button click, of the web page that is being displayed on my webview activity and save it to the sd card.

i have in my manifest the right permission to write external storage and all webview features are working just great, just when i attempt to capture the image.

 public void onClick(View v) {
    switch(v.getId()) {

            case R.id.button1:
                WebViewClientDemoActivity.web.goBack(); 
                break;

        case R.id.button2:
                WebViewClientDemoActivity.web.goForward();
                break;

            case R.id.button3:
                WebViewClientDemoActivity.web.capturePicture();
                //Capture Picture
            Picture picture = WebViewClientDemoActivity.web.capturePicture();
            //Create a new canvas
            Canvas mCanvas = new Canvas();
            //Draw the Picture into the Canvas
            picture.draw(mCanvas);
            //Create a Bitmap
            Bitmap sreenshot = Bitmap.createBitmap(picture.getWidth(),
            picture.getHeight(),Config.ARGB_8888);
            //copy the content fron Canvas to Bitmap
            //mCanvas.drawBitmap(mBitmapScreenshot, 0, 0, null);
            mCanvas.drawBitmap(sreenshot, 0, 0, null);
            //Save the Bitmap to local filesystem
            if(sreenshot != null) {
                   ByteArrayOutputStream mByteArrayOpStream = new
            ByteArrayOutputStream();
                    sreenshot.compress(Bitmap.CompressFormat.JPEG, 90,
            mByteArrayOpStream);

                try {
                    File folder = new File(Environment.getExternalStorageDirectory().toString()+"/Enlighten/Images");
                    folder.mkdirs();
                    // create a File object for the parent directory
                    File outputFile = new File(folder, "enlighten.jpg");
                    // now attach the OutputStream to the file object, instead of a String representation
                    FileOutputStream fos = new FileOutputStream(outputFile);
                    fos.write(mByteArrayOpStream.toByteArray());
                    fos.close();
                    Toast.makeText(WebViewClientDemoActivity.this, "File Created", Toast.LENGTH_SHORT).show();
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    Toast.makeText(WebViewClientDemoActivity.this, "File Not Found", Toast.LENGTH_SHORT).show();
                } catch (IOException e) {
                    e.printStackTrace();
                }               

Im getting this error message. (UPDATED)

10-15 11:33:10.336: W/System.err(20577): java.io.FileNotFoundException: /mnt/sdcard/Enlighten/Images/enlighten.jpg: open failed: ENOENT (No such file or directory)
10-15 11:33:10.336: W/System.err(20577):    at libcore.io.IoBridge.open(IoBridge.java:406)
10-15 11:33:10.336: W/System.err(20577):    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
10-15 11:33:10.336: W/System.err(20577):    at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
10-15 11:33:10.336: W/System.err(20577):    at com.jaisonbrooks.enlighten.WebViewClientDemoActivity.onClick(WebViewClientDemoActivity.java:374)
10-15 11:33:10.336: W/System.err(20577):    at android.view.View.performClick(View.java:3565)
10-15 11:33:10.336: W/System.err(20577):    at android.view.View$PerformClick.run(View.java:14165)
10-15 11:33:10.336: W/System.err(20577):    at android.os.Handler.handleCallback(Handler.java:605)
10-15 11:33:10.336: W/System.err(20577):    at android.os.Handler.dispatchMessage(Handler.java:92)
10-15 11:33:10.336: W/System.err(20577):    at android.os.Looper.loop(Looper.java:137)
10-15 11:33:10.336: W/System.err(20577):    at android.app.ActivityThread.main(ActivityThread.java:4517)
10-15 11:33:10.336: W/System.err(20577):    at java.lang.reflect.Method.invokeNative(Native Method)
10-15 11:33:10.346: W/System.err(20577):    at java.lang.reflect.Method.invoke(Method.java:511)
10-15 11:33:10.346: W/System.err(20577):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
10-15 11:33:10.346: W/System.err(20577):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
10-15 11:33:10.346: W/System.err(20577):    at dalvik.system.NativeStart.main(Native Method)
10-15 11:33:10.346: W/System.err(20577): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
10-15 11:33:10.346: W/System.err(20577):    at libcore.io.Posix.open(Native Method)
10-15 11:33:10.346: W/System.err(20577):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
10-15 11:33:10.346: W/System.err(20577):    at libcore.io.IoBridge.open(IoBridge.java:390)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:10:08+00:00Added an answer on June 12, 2026 at 6:10 pm

    The openFileOutput() expects just the file name, without path separators, because it assumes that the file will be created in the app’s private data area (if my memory doesn’t cheat me then it should be /data/data/[your app package name]/files/).

    To create a file on sdcard you can use FileOutputStream directly, see here for an example.

    And another advice is that don’t use hardcoded path like /mnt/sdcard because the absolute path of sdcard may vary on different devices, instead you should use Environment.getExternalStorageDirectory()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to capture urls in an html page that is being repeated
I am trying to capture my web cam and then try to save it
I'm trying to capture key-value pairs from strings that have the following form: a0=d235
I'm trying to capture the picture I'm getting from webview.capturePicture() to save it to
I'm trying to capture http request that occurs in a callback function : //
I'm trying to capture packets from two devices on my network. I have tcpdump
I'm trying to capture key presses so that when a given combination is pressed
I have been trying to capture stdout and stderr output from a DLL compiled
I'm trying to generate thumbnails of several pages that will be displayed through a
I am trying to capture a right mouse click on a Bing map. All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.