If you allow, my friends. I am still new in the world of the Android. I am looking for the code of the basket button in the picture.
I have 4 activities. I want to collect the data entered in each activity through button send to the basket and store this data temporarily in the basket button until the completion of the collection of data from all activities. Then when pressing the basket button, I want to send this data to a new activity showing all the data Which was stored in the basket button.
I read a lot about this topic, and all the answers were about getTag
and setTag
.
But I really did not know how to handle this code.
Can anyone help me explain more about this instruction and how can I deal with it? Thank you very much.
This code that I try, does it send text and price to button??
Button fab;
Intent intent = new Intent( this, FloatingActionButton.class );
String keyIdentifer = null;
intent.putExtra( "String", text );
intent.putExtra( "Int", price );
fab.setTag( "input" );
And in the button code I used this code to send the received data to the last activity when you press the button. Is this correct???
final FloatingActionButton fab = (FloatingActionButton) findViewById( R.id.fab );
fab.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent( MainActivity.this, Main3Activity.class );
fab.getTag( Integer.parseInt( "input" ) );
startActivity( intent );
}
} );