Antonio Solana
Antonio Solana

Reputation: 119

Updating textView constantly

I need to update 2 textViews everytime someones opens the activity they are on. The problem is that if you tap the back button to go to that activity the onCreate method won't activate and the data won't update.

Upvotes: 0

Views: 54

Answers (2)

Abhi Muktheeswarar
Abhi Muktheeswarar

Reputation: 394

Put the code to update in activity onResume method.

Upvotes: 1

Tobias
Tobias

Reputation: 168

If you enter another app, your activity is paused. Remember that OnCreate is only called when your activity is started. You need to run your code also in OnResume:

@Override
public void onResume(){
     super.onResume();
     // Your code to activate TextView

}

Upvotes: 1

Related Questions