I have two activities, Home.java
and Profile.java
.
When user clicks on someone's profile in ListView in Home.java I get username for that user, store it in static variable Home.usernameProfile
and go to Profile.java where I load data for clicked username using static variable Home.usernameProfile
.
From Profile you can go to another Profile (start new Profile.java
activity) and then you set Home.usernameProfile
for the new Profile.
Problem is that if I return from the second Profile to the first Profile in Home.usernameProfile
variable I will still have username for the second Profile, and I need to have username for the first Profile because I do things in Profile that requires Home.usernameProfile
variable.
I tried to create TextView in Profile.java, store Home.usernameProfile
variable value in a TextView and return it to Home.usernameProfile
on activity restart using public void onRestart() { super.onRestart(); ...}
, but TextView returns some other value.
Does anyone know how could I get username for currently displayed Profile when returning from other Profile?