OK well in that case do this:
Button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(YourActivity.this,DetailActivity.class);
i.putExtra("text","Some String for this one");
startActivity(i);
}
});
Button2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(YourActivity.this,DetailActivity.class);
i.putExtra("text","Some other String for this one");
startActivity(i);
}
});
As you can see, the method putStringExtra()
form Intent
allows you to send in some information. So in your DetailActivity
class you can get it like so:
Intent intent = getIntent();
String text = intent.getStringExtra("text");
//and now you have the text you sent in when you created the Activity
So you can make your DetailActivity
in a way where it displays whatever is sent with the intent's extras.