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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:23:40+00:00 2026-06-04T11:23:40+00:00

My answer to this question was just accepted but I started to wonder when

  • 0

My answer to this question was just accepted but I started to wonder when exactly one needs to invalidate() a View and when it is not necessary?

After a bit of thinking I came to realization that it should work more or less like this:

  • actual drawing of “everything” occurs after onResume()
  • in “free” time parts of the screen can be redrawn but only those that were invalidated (and everything underneath)

Therefore, it would seem, if I change something after onResume() (e.g. as a response to a button click, I should invalidate() the changed View).

However, from what scana in this question says, it must be more complex then that and it depends somethimes on what method one uses.

E.g. on whether one uses

lastClicked.setImageBitmap();

or

lastClicked.setImageResource();

So, when it’s necessary to execute invalidate() on a View and how does it really work ?

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

    Usually, the system handles resizing, hiding, showing and a ton of other things for your widgets automatically but it sometimes has issues if the underlying buffer for drawn pixels or backing data has changed or is stale (you swap the image resource on a View or the raw dataset changes). This occurs because there is no way that the OS can know that the data changed in the specific manner that it did.

    In these cases where you are dealing with drawing, you have to tell the system that its underlying data is not in a good state with Widget.invalidate() and the re-drawing gets queued on the main thread just as you mentioned. Depending on the system implementation and Android version what is tracked for changes by the system varies but what I normally do is assume that system resources (byte arrays, char arrays, resource indexes, manual drawing on the context) are not tracked and need an invalidate and everything else will be handled by the system.

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

Sidebar

Related Questions

I know I've seen the answer somewhere to this question but I just can't
The accepted answer to this other question lead me to this sample, but compiling
I just read the accepted answer of this question , which left me with
I have not marked this question Answered yet. The current accepted answer got accepted
[see later answer for more] I think this is just a simple rails question,
EDIT2: OK this is weird. (I can't answer my own question, so I just
I just saw this question and one of the answers looks really appealing to
The manual does not answer this question : it says the name of the
I just accepted a similar question ( PHP + MySQL Queue ), but I
I know this type of question has been asked before, but I could not

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.