I've been searching for a method that passes the data from one activity to another. I found several ways to do so. Even here i found many people asking this question! I tried to solve this problem as I found here and in many other websites (using the intent). But it is no use! this is really weird because the intent method works with everyone else but when I try, it doesn't work at all really I don't know what is wrong with my code!!! I just want to pass the username and the birthday from Register activity to Profiles activity, here is what I've tried so far:
private TextInputLayout textInputLayoutName;
private TextInputLayout textInputLayoutEmail;
private TextInputLayout textInputLayoutBirthday;
private TextInputEditText textInputEditTextName;
private TextInputEditText textInputEditTextEmail;
private TextInputEditText textInputEditTextBirthday;
if (!databaseHelper.checkUser(textInputEditTextEmail.getText().toString().trim())) {
user.setName(textInputEditTextName.getText().toString().trim());
user.setEmail(textInputEditTextEmail.getText().toString().trim());
user.setPassword(textInputEditTextPassword.getText().toString().trim());
databaseHelper.addUser(user);
Snackbar.make(nestedScrollView, getString(R.string.success_message), Snackbar.LENGTH_LONG).show();
emptyInputEditText();
Intent intent = new Intent(RegisterActivity.this, ProfilesActivity.class);
intent.putExtra("username", textInputEditTextName.getText().toString());
intent.putExtra("birthday", textInputEditTextBirthday.getText().toString());
startActivity(intent);
and here is how I get them from the Profiles activities in the OnCreate method:
private TextView theName;
private TextView theBirthday;
theName= (TextView) findViewById(R.id.theName);
theBirthday=(TextView) findViewById(R.id.theBirthday);
Intent intent = getIntent();
String username = intent.getStringExtra("username");
String birthday = intent.getStringExtra("birthday");
theName.setText(username);
theBirthday.setText(birthday);
It shows me nothing in the Profiles activity! I don't now what is the wrong here! please help if you know where my issue is !
for editor: I found so many similar questions but my problem is different