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 7831443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:44:02+00:00 2026-06-02T11:44:02+00:00

I try to make a Bitmap from a view in Android in this way:

  • 0

I try to make a Bitmap from a view in Android in this way:

Bitmap myBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas myCanvas = new Canvas(myBitmap);

TextView myText = new TextView(myContext);      
newText.setText("This is the text that its going to appear");

myText.layout(0, 0, width, height);
myText.draw(myCanvas);

and it works the same as for other views such as ImageView,….

But when i want to create a Bitmap from WebView, it is created but content does not appear.
I also tried to use WebViewClient to detect when content has been already loaded, but the result is the same. Bellow is code i’ve used:

Bitmap myBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas myCanvas = new Canvas(myBitmap);

String mWebViewContent = "<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>";
 WebView lWebView = new WebView(myContext); 
 lWebView.layout(0, 0, width, height);      
 lWebView.setBackgroundColor(Color.GREEN);      
 lWebView.setWebViewClient(new WebViewClient(){     

            @Override
            public void onPageFinished(WebView view, String url) {
                view.draw(myCanvas);    
                    //content height is 0 at this point
                Log.d("info", "height: " + view.getContentHeight());                
                super.onPageFinished(view, url);
            }


        });
lWebView.loadData(mWebViewContent, "text/html", "utf-8");

Bitmap is created with green background but content does not apear. Any suggestions why the content is not drawn in the WebView or at what moment it can be ready for drawing?
Thanks in advance for any help!!!

  • 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-02T11:44:04+00:00Added an answer on June 2, 2026 at 11:44 am

    You should check out the answer at:

    Rendering Android webview to bitmap, html5 javascript , callback issue

    The key factor here is the postDelayed() call. There is a small lag between when the WebClient.onPageFinished() is called and when the page is actually rendered. It would be nice if there was a onPageRendered() method.

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

Sidebar

Related Questions

I try to make an animation with an image in my view but it
I try to make an Android application which communicates with a non-standard ISO15693 (NFC-V)
Whenever I try and make any Twitter request, my application always hangs. This does
I'll try to make this as straight forward as possible. Currently our team has
I will try to make this as clear as I can, but if you
Do you know why this make my application to close unexpectedly: b2.setOnClickListener(new View.OnClickListener() {
I try to make a registration form. When user post the fields, i check
I try to make Ext.Data.Store working... With a normal proxy it works great: var
I try to make have an EventListener in ItemRenderer but its not working. How
I try to make a displaying list with onmouseover() with some links but they

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.