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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -