I have a bunch of buttons with( the texts inside are date like FRI 12 ) in the screen for user to select. I want to get the text from the selected button to pass it to another activity but still struggle.
I google it for hours and try the code like this
private String date_selected;
public void onClick(View button) {
Button b = (Button)button;
date_selected = b.getText().toString();
Log.d("myTag", date_selected);
Toast.makeText(this,date_selected,Toast.LENGTH_LONG);
}
But it doesn't work. Please help me to solve the problem, I have 3 hours left for my deadline (this is a small homework for my mobile course).
Thank you for your help.