Reputation: 102
intent.putExtra()
and intent.getStringExtra()
are not working. getStringExtra returns null
At sending side:
Intent intent = new Intent(getApplicationContext(), ChooseUserActivity.class);
startActivity(intent);
intent.putExtra("Name",imageName);
At receiving side:
Intent secondIntent = getIntent();
String nameImage = "Something " + secondIntent.getStringExtra("Name");
Log.i("Name of the Image: ",nameImage);
The output of the Log cat:
Upvotes: 1
Views: 259
Reputation: 849
You should first put Extras in Intent and then start activity not after it
//create intent
Intent intent = new Intent(getApplicationContext(),ChooseUserActivity.class);
//put extras
intent.putExtra("Name",imageName);
//start activity
startActivity(intent);
Upvotes: 1