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

  • SEARCH
  • Home
  • 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 8006381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:29:48+00:00 2026-06-04T17:29:48+00:00

I have a WebView with data populated from local javascript (in the asset folder).

  • 0

I have a WebView with data populated from local javascript (in the “asset” folder). The WebView takes several seconds to load so I’d like to keep it on device rotation. I don’t want to use configChanges since it has some other collateral effects.

It seems to me that the best approach is to make a Picture from the WebView and load the Picture instead of the WebView on rotation but I can’t figure out how.

Here is the code I tried:

Canvas canvas = new Canvas();
pictureNightDay.draw(canvas);
Bitmap b = Bitmap.createBitmap(pictureNightDay.getWidth(), pictureNightDay.getHeight(),Config.ARGB_8888);
myWebViewNightDay.draw(new Canvas(b));

but this only shows a blank View.

The “pictureNightDay” was previously saved with

pictureNightDay = myWebViewNightDay.capturePicture();

Thanks, bye
Maurizio

  • 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-04T17:29:50+00:00Added an answer on June 4, 2026 at 5:29 pm

    At last I came with the following answer: I used two Views, one WebView and one ImageView (initially hidden)

    Save the picture when WebView is loaded:

    pictureNightDay = myWebViewNightDay.capturePicture();
    

    (pictureNightDay is a static field).

    Then on rotation check if pictureNightDay is not null and swap the ImageView and WebView visibility:

    ImageView im = (ImageView) l.findViewById(R.id.tripreport_tipology_imagenightday);
    im.setImageDrawable(new PictureDrawable(pictureNightDay));
    im.setVisibility(View.VISIBILE);
    myWebViewNightDay.setVisibility(View.GONE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to load a local javascript file from a webview. The file
I have an application with WebView I tried to load external data via Ajax
I have a WebView. I'd like to show some page from my server, but
I have Activity with some data displayed in WebView that I load with WebView#loadDataWithBaseURL
I have used a webview named Testview to load html data in the webview.
I have WebView in myLayout and I am trying to load html string like
I am using webview to display Data from RSS Feed Can I change color
I have a webview and I load some html5+js into it. My webapp is
I load HTML data into WebView with loadDataWithBaseURL Do it one more time Execute
I have got a PHP/HTML page where I want to fetch data from but

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.