java - Change action based on which button opened Activity? -
i'm trying make app asks user maths questions. have number of buttons, such multiplication, addition etc. want code have series of if/else statements tells operator use based on button clicked in previous activity.
what use access information?
just put button id in intent. this;
intent i=new intent(context,myactivity.class); i.putextra("button_id", buttonid); context.startactivity(i);`
then in activity;
intent =get intent(); int buttonid = intent.getintextra("button_id");
Comments
Post a Comment