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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:15:22+00:00 2026-05-31T02:15:22+00:00

I have a Layout which as a ImageView, ListView, some TextViews etc wrapped in

  • 0

I have a Layout which as a ImageView, ListView, some TextViews etc wrapped in a ScrollView. Whenever the user scrolls the Parent View calls all the child view’s draw() methods. Since my ImageView is a complex bitmap constructed on the fly the scroll really becomes laggy because my imageview’s draw() is called continuously, which delagates to ImageView.onDraw() and which in turn delegates to my complex ConstructMyBitmap.draw() and redraws my bitmap every single time.

I need to suppress this imageView.onDraw() call on scrollevent. I dont want to redraw my complex bitmap everytime when a scroll happens.

How to identify scrollevent inside onDraw()?

Or is there a better way to handle this?

To Romain Guy:

   protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        if(chart != null && chart.shdRedraw())
            {
               chart.draw(canvas);
        }else
            {
              //Do nothing - Canvas should retain the old data
            }
        // :-) Happy, Now I control when the chart shd be drawn but.. :-(

    }

Unfortunately when onDraw() gets called onScroll event and I decide not to draw the chart the result is a blank chart area. The canvas given to me in the onDraw() doesnt contain the previously drawn information. Dont know whether onDraw() flushes the canvas? Any guidance on this?

  • 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-05-31T02:15:24+00:00Added an answer on May 31, 2026 at 2:15 am

    The screen needs to be redraw on a scroll so the only way to achieve what you want is to cache your View (using View’s drawingCacheEnabled property.) This is however costly in terms of memory. Why don’t you simply change your draw() code to only recreate your expensive bitmap when it has changed?

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

Sidebar

Related Questions

I have a layout which contains some views like this: <LinearLayout> <TextView...> <TextView...> <ImageView
I have a simple layout file which displays the icons and some text view
I have a problem with my listview which contains an ImageView and a few
I have an info tab, which should have a listview, imageview and textview. For
I have a ListView which contains an ImageView and a TextView. I'm subclassing ArrayAdapter
I have a list view.Each row of the this listview is the following layout.How
I have a layout which uses min-width and works great. So I came to
I have a layout in which I am displaying a webview . I want
I have a div in which a page is loaded with the DojoX Layout
I have a layout as follows: <div style=width: 300> <div style=width: 300>Some Content</div> </div

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.