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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:23:31+00:00 2026-05-27T06:23:31+00:00

I have an android app which was built on eclipse. What i am currently

  • 0

I have an android app which was built on eclipse. What i am currently doing is going through set of question in xml file randomly to ask. Xml file looks like this:

<item>
    <ques></ques>
    <option1></option1>
    <option2></option2>
    <option3></option3>
    <ans></ans>
    <level>1</level>
</item>
<item>
    <ques></ques>
    <option1></option1>
    <option2></option2>
    <option3></option3>
    <ans></ans>
    <level>1</level>
</item>
<item>
    <ques></ques>
    <option1></option1>
    <option2></option2>
    <option3></option3>
    <ans></ans>
    <level>2</level>
</item>

so on….

Right now i am selecting question from level one randomly. Like there are 50 question in level 1 and 50 in level 2. I want to select question in order now. Like start from the top to bottom. Like if user A logs in plays the game he is being asked question a and b from level 1. Then he closes the game and logs back again so he should see c and d now.

My problem is how can this state be saved in android? Is there a easy way to do 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-27T06:23:31+00:00Added an answer on May 27, 2026 at 6:23 am

    What you could do is, is for each level have it numbered

    For level 1 question a int variable to keep track of the question the user is on. You could have

    int questionNumber;
    

    in your method declare for each question the user gets to

     questionNumber++;
    

    Now when the player leaves the activity or logs out of the app.

    Put the question number in the Shared Preference like this..

      SharedPreferences app_preferences = 
            PreferenceManager.getDefaultSharedPreferences(this);
    
     SharedPreferences.Editor editor = app_preferences.edit();
        editor.putInt("questionNumber", questionNumber);
        editor.commit(); // Very important
    

    Now to pull the number out just use..

      SharedPreferences app_preferences = 
            PreferenceManager.getDefaultSharedPreferences(this);
    
        // Get the value for the run counter
        questionNumber = app_preferences.getInt("questionNumber", 0);// The 0 is there for if the user hastn played before it is set to 0 automatically or you can set it to 1
    

    EDIT:

    Also you could have a Variable that keeps track of the Level the user is on such as

    int userLevel;
    

    And just save it to shared preference as you did before.

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

Sidebar

Related Questions

I have built an android app which use Google Map feature. I want my
I have a class that extends android.app.Dialog, the layout is done in an xml
I'm defining a style XML for my android app. I have some TTF files
I have a simple question. I am trying to design a simple Android app,
I'm going to implement my strings with internationalization in my Android app. I have
I have an android app which needs to be signed using a specific keystore
I've built a Jquery Mobile Android App using Phonegap which contains a form with
I have two projects: 1- Project A: Which is the Android app project. 2-
I have an Android App with a pre-built SQLite DB packaged with it. However,
I have built an android application which has a single mapview. I have a

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.