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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:56:52+00:00 2026-06-01T08:56:52+00:00

I have managed to reload the list item in a list when the activity

  • 0

I have managed to reload the list item in a list when the activity call’s it’s onStop() method. Here I want to store what’s generated by pressing a button. If you have read my previous few posts you will know what’s happening but this is a different question.

Using my code:

listLimit = listItems.size() - 1;

                for( int i = 0; i < listLimit; i++ )
                {
                    storeList[i] = listItems.get( i ).toString();
                    tempDataStore = storeList[i];
                    editor.putString( DATA,tempDataStore );

                }
                editor.commit();

I store the values of the storeList. I know that the way it’s done above will basically overwrite the tempDataStore every time it iterates through. Which means when it’s recalled in the onCreate() method only the last value of the list will be loaded. So how do I fix this? How can I uniquely identify each list item without creating a new String variable for each?


UPDATE

I kinda of sorted it by changing the key on and keeping the value. When I add them like this:

listItems.add( 0, settings.getString(  DATA+"0",tempDataStore ) );

It works. But when I try to do the same thing in a for loop, like so:

for( int i = 0; i < listLimit; i++ )
            {
                listItems.add( i, settings.getString(  DATA+""+i,tempDataStore ) );
            }

Noting happens. Why so?

  • 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-01T08:56:53+00:00Added an answer on June 1, 2026 at 8:56 am

    I determined the reason – it was because listLimit was actually equal to zero therefore the loop would never start. So to rectify this I stored the value of the list like so:

    listLimit = listItems.size() - 1;
    // Place size of list into storage
    editor.putInt( "LIST_SIZE",listLimit );
    

    And then recalled it to the start of the for loop here:

        // Toast.makeText( getApplicationContext(), "list size: "+settings.getInt( "LIST_SIZE",listLimit ),Toast.LENGTH_LONG).show();
        for( int i = 0; i < settings.getInt( "LIST_SIZE",listLimit ); i++ )
        {
            listItems.add( i, settings.getString(  DATA+""+i,tempDataStore ) );
            adapter.notifyDataSetChanged();
        }
    

    Hope this helps whoever

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

Sidebar

Related Questions

I have a problem to refresh or reload an application scoped managed bean. It
I have managed to set up Cassandra + Thrift and the Python wrapper for
I have managed to get a cron job to run a rake task by
I have managed to create a custom action in C# using MakeSfxCA which is
I have managed to bring the following output with this query SELECT DISTINCT IF(purchaseproduct_customerid=0,contactperson,vendorname)
I have managed to put this condition and rule below together to redirect a
I have managed to run hadoop examples grep, wordcount... however I am finding some
I have managed objects that have image properties. Since storing large blobs in CoreData
I have managed to crunch down a several line code to this For Each
I have managed to successfully deploy my Symfony2 application to a production web server,

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.