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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:50:21+00:00 2026-05-30T03:50:21+00:00

I have a problem in a custom view. Its state is not saved after

  • 0

I have a problem in a custom view. Its state is not saved after I turn off the screen and turn it back on.

onSaveInstanceState is called correctly when I turn the screen off, but when I turn the screen on, onRestoreInstanceState is not called. I understand that it’s because the activity is not recreated, but I don’t know what else to use to restore the state of the view.

I think I would need to do something at onStart() or onResume(), but I don’t want to do this in the activity, but in the view, because the view is used in multiple activities and it would be very inconvenient.

I’ve tried several other methods, like onWindowsVisibilityChanged, but no luck.

What other method could I use?

Thank you.

EDIT: Details: what I want to keep is only a boolean to let me know if the button is toggled on or off, so I can change it’s appearance. I know it should keep its appearance without my intervention, but the implementation is a little buggy.

  • 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-30T03:50:24+00:00Added an answer on May 30, 2026 at 3:50 am

    After some more trying, I managed to get the event I needed in onWindowFocusChanged(Boolean hasWindowFocus). As far as I’m concerned, it gives me the same opportunity as onResume(), because it’s called just as the window becomes visible and is brought to front.

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

Sidebar

Related Questions

We have a screen and its view model: public class ScreenViewModel : BaseViewModel {
I have a grouped table view which consists of custom cells. The problem is
I seem to have a problem with getting MVC to fill in my custom
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I have a custom Jabber IM client and I'm having a problem with links.
My problem is similar to Django Passing Custom Form Parameters to Formset Ive have
I have designed a custom section handler before but I'm faced with a problem
I have a table cell for which I set its contentView to a custom
I have several parts in my app where I use custom table view cells.
I have a listview with custom array adapter, the view allows the user to

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.