Each user has its profile that is stored in a XML file linked to a Java class. But not necessarily they access this profile when they use the App, because they may just use the app without editing its profile information. I need to know if there’s a way to know if a user has filled his name in his profile activity. I’ve thought about using Intents to pass the name variable, but since they don’t necessarily open the profile file I dont know if it would work
Advertisement
Answer
I do not know if it’s suitable for you.
But if your goal is to know if a field in another activity was filled in Android (Java),
I think, one approach is to make a change subscription then set a variable from Application class
Like this :
public class YourApplicationClassname extends Application {
private boolean isProfileNameIsEdited = false;
public boolean isProfileNameIsEdited() {
return this.isProfileNameIsEdited;
}
public void setProfileNameIsEdited(boolean isProfileNameIsEdited) {
this.isProfileNameIsEdited = isProfileNameIsEdited;
}
}
And use this as the application class in your android manifest
<application
android:name=".YourApplicationClassname"
Then, when the field in the profile that you like to monitor is edited, you update the isProfileNameIsEdited attribute, and you can check in your other activity