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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:45:15+00:00 2026-06-13T19:45:15+00:00

I am working on this app where I have one EditText field where you

  • 0

I am working on this app where I have one EditText field where you can write something and then it get saved and added to a list(TextView). I save the content of the EditText in this way:

saved += "*" + editTextFelt.getText().toString() + ". \n";

saved is a String.
Everything works fine, I can even reload the app and it’s still displayed in the TextView, but if I try to write something and save it everything that was there, now disappears. Why?

CODE:
init Method()

sp = getSharedPreferences(fileName, 0);
betaView = (TextView)findViewById(R.id.betaTextView);

I’ve got a button to send the text, and this is like:

public void onClick(View v) {
        switch(v.getId()){
        case R.id.btnSend:
            saved += "*" + editTextFelt.getText().toString() + ". \n";
            SharedPreferences.Editor editor = sp.edit();
            editor.putString("SAVED", saved);
            editor.commit();

            betaView.setText(sp.getString("SAVED", "Empty"));   
  • 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-13T19:45:16+00:00Added an answer on June 13, 2026 at 7:45 pm

    How are you saving it? because when you save a text against a variable it replaces the previous one.

    So you need to get the previous one and then append the new one and then again save it to SharedPreferences, something like this:

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    String saved = sp.getString("YourVariable", "");
    saved += "*" + editTextFelt.getText().toString() + ". \n"; //appending previous
    //Editor to edit
    SharedPreferences.Editor editor = preferences.edit();
    editor.putString("YourVariable",saved);
    editor.commit(); //don't forget to commit.
    

    now set this appended text to your TextView like this:

    betaView.setText(saved);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have createn an app, this app can be found here Everything is working
Even using the default test code on my app I can't get this working.
I have been working on this app for at least 3-4 months and just
This part of an app that I am working on, I have the following
In my project I have one app which have its own urls.py like this
I have been working on an app screen which include a edittext of numeric
I have created one songs album app. In this app, i have to play
I am working on a android app and I have an EditText where user
I'm working on a simple url-shortening app and have the following express routes: app.get('/',
I have an app with an embedded webserver. This webserver can now do SSL

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.