0

Hi i've problem with activities because i'm Newbie in Android i have two activities : when the first activity finishes, the second begins and the second activity are change in it's content elemnts


( This in the first "default" Activity )

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();

        final Context context = this;
        AppPrefs appPrefs = new AppPrefs(context);
        String Last_Activity = appPrefs.getValue("Last_Activity");
         if(Last_Activity == "listV"){
             finish();
             Intent i = new Intent(this, NewClas.class);
             startActivity(i);



         }
}

when app is in background then i open it: every elements that had changed became as what it was ,

i mean that All changes returned as before

What I want is resume activity and appear it's changes that it was making when app was in background.

Sorry for my English i hope someone helps me Thanks a Lot ..

Ahmed Sabry
  • 394
  • 1
  • 7
  • 16

2 Answers2

2

Ahh.. Your If condition never become true,

It should be like,

 if(Last_Activity.equals("listV")){ ... }
user370305
  • 106,566
  • 23
  • 160
  • 150
1

You can use onSaveInstanceState() to save any values you want in a bundle and then restoring them in onRestoreInstanceState().

Nermeen
  • 15,770
  • 5
  • 57
  • 71