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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:22:20+00:00 2026-06-04T19:22:20+00:00

Just a bit about my app first. Its a quiz app. It has a

  • 0

Just a bit about my app first. Its a quiz app. It has a main screen displaying a question, which loads straight away, and arrows going previous and next which go to other quiz questions. I’m using the same layout over and over, just by passing different question data, so when I click the “next” button, it will just launch an intent to the same class, just with different data. At the start of my one single layout, I have a little check to see if the user has clicked to hide the disclaimer or not.

So my disclaimer pops up at the start of the app. It has a dismiss button and a Dont show this again checkbox. I can get the checkbox working perfect, using SharedPreferences but the problem arises when they hit the Dismiss button. Since I’m reusing the same layout, any time the user navigates to a new question, the disclaimer pops up. I only want it to popup on the first screen, e.g. when the app loads.

I have tried setting another SharedPreference to hide the disclaimer when the user hits dismiss but once I hide it, it never comes back, because when the user loads the app back up again, that shared preference is still set. My problem is knowing where to set the preference back! I tried resetting it in onPause() but that didn’t work.

So, what I’m asking is, how can I determine if an activity is the first one to be loaded so I can only do the Disclaimer check then, and not in each of the subsequent screens?

Thanks.

EDIT: Here’s my OnCreate() method:

final static String disclaimerShownPref = "disclaimerShown";
final static String disclaimerShownOnce = "disclaimerShownThisSession";

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    //Checks to see if the boolean is set
    //The second argument is the default to use if the preference can't be found
    if(!mPrefs.getBoolean(disclaimerShownPref, false))
    {
        if(!mPrefs.getBoolean(disclaimerShownOnce, true))
        {
            new Disclaimer(this);
        }
    }

    topMostLayout=buildHomeScreen();
    setContentView(topMostLayout);
}
  • 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-04T19:22:22+00:00Added an answer on June 4, 2026 at 7:22 pm

    In your case I would suggest using a static variable in your activity:

    private static boolean sFirstTime = true;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        setContentView(R.layout.main);
    
        if( sFirstTime )
        {
            /*
             * Place the disclaimer check here 
             */
            sFirstTime = false;
        }
        else
        {
    
        }
    

    Having said that. I would consider a better approach to switch between questions in the same instance of your activity instead of creating a new one every time.

    Good luck!

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

Sidebar

Related Questions

I just started doing my first Android app which happens to be an RSS
I've just started playing with PowerMock and EasyMock and I'm a bit confused about
Alright, I'm just trying to learn about using Contact information, but I'm a bit
I'm currently building my first Django-based app, which is proceeding fairly well, thus far.
i'm just starting to learn about database design. For my first project I made
Okay this is a fairly broad question. This is my first App and I'm
I have an iphone app which has an NSURLConnection downloading a large video file.
I am just learning about app.config in respect of creating custom sections. I have
just a bit confused by this code var counter = function() { //... var
Would love some help here. I'm sure it's simple enough, I'm just a bit

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.