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

The Archive Base Latest Questions

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

i want to force use to fill Settings Page in two cases 1) when

  • 0

i want to force use to fill Settings Page in two cases

1) when user first launch Application
2) when database version is change i want that setting page should be filled first before proceding

in my Setting class i set shared preferences “false” , and then i check it in below code

class setting //main class
String flag = sharedPreferences.getString(“CreatedFlag”,””);

     if(flag.equals("true"))
       {
            // Move to second activity
            Intent i =new Intent();
            i.setClass(someclass.this,otherPage.class );
             startActivity(i);
            finish();
       }
     else
     { // Stay on Settings page }

Problem : it run fine when user first launch application ,it show setting page and fill tht page ,
but when user run application second time it show setting page again ,coz shared preference still have true value ,
thn again user run app 3rd time Shared Preference have update value which is false ,and show other page

what i want is tht Setting page show only once if its there is no setting define ,other wise it goes to home page

need 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-04T05:57:24+00:00Added an answer on June 4, 2026 at 5:57 am

    I dont shee here where you’re actually saving the preferences, I assume its in the otherPage activity??

    If not add this to the first activity

    SharedPreferences prefs = this.getsharedPreferences("myApp",0);
    //check for the Created value in the shared preferences
    String createdFlag = prefs.getString("Created","false"); // set default value == false
    if(createdFlag == "false){
        goToSettingsPage(); // to the settings page we go...
    }
    

    Then on your settings page:

    SharedPreferences prefs = this.getSharedPreferences("myApp",0);
    SharedPreferences.Editor ed = prefs.edit(); // create the editor
    ed.putString("Created","true"); // put the value to the prefs
    ed.commit(); // commit the changes
    

    After the first run, the shared prefs file will be persisted, and then should not goto the settings page the second time its run.

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

Sidebar

Related Questions

When users go on my website, I want to force them to use Internet
I want to use autocomplete (jquery or .net) with force a choice so that
I want to force users to use https on my site. I use this
I want force certain routes to always use a secure connection in my express
I have a fairly simple check constraint, where I want to force two columns
I am using CakePHP as my framework. On page load, I want to force
I want to force user to download images. Not open in browser. It is
I want to force the download of an image. I have found this code:
I want to force the Chrome debugger to break on a line via code
I'm using Matlab to solve a differential equation. I want to force ode45 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.