I have code that direct users to the profile page from the bottom bar.
private void startNewIntent(Class className, String uid){
Intent intent = new Intent(act, className);
intent.putExtra("uid", uid);
act.startActivity(intent);
act.finish();
}
className = DisplayProfile.class;
if(FirebaseAuth.getInstance().getCurrentUser() != null){
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
startNewIntent(DisplayProfile.class, uid);
} else {
startNewIntent(EmailPasswordActivity.class);
}
in ProfileActivity.java
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
String uid = getIntent().getStringExtra("uid");
if(uid != null){
...
}
}
I also tried with Bundle = getIntent().getExtra()
with the same results. I have seen similar questions. This seem to be the case: getIntent() Extras always NULL
I tried
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
but getIntent().getExtra != null
is still false.
Thank you for your help and advice.
Edit: added context for startNewIntent()