android - Select radio buttons and perform action according to that -
hey guys thinking , trying on problem since last 1 day. searched lot didnt trying do.
ok let me tell you. trying make app, app calculations based on user inputs ( in calculator)
firstly have created radio group 2 radiobuttons.
then after 3 text boxes , atlast button.
now trying implement java :
when user select 1st radio button should display 2 text fields , when user selects 2nd radio button should display 3 text fields.
and after when user inputs required values , click on calculate should work according input values.
means having different formulas implemented onclicklistener button.
now let me explain whole thing taking example.
when 1st radio button selected
suppose start app , 1st radio button selected. , 2 text fields there. user inputs values , click calculate , should display "sum" of both numbers.
when 2nd radio button selected
now user selects 2nd radio button , 3 text fields displayed. user enters value in 3 , click calculate , should display multiplication of 3 numbers.
guys trying implement thing since last 1 day or more getting more , more confused of do. how hide 3rd text field if 1st radio button selected , how implement 2 different formulas when calculate button pressed depending on radio button , text fields...please me.
dont think asking code. need suggesions , advices on how implement thing.
please dont rate question negative i'm posting question after trying could.
thanks
to enable/hide text field.. try using function called .setenabled()
.. here's example of how it's used :
edittext edit = (edittext) findviewbyid(r.id.edittext01); edit.setenabled(false);
as checking if radio button checked or not .. use the.ischecked()
function fallows :
button1 = (radiobutton) findviewbyid(r.id.rbtnbutton1); if(button1.ischecked()) { /*do something*/ }
it'd lot more helpful if you'd posted sort of code, no matter how simple in order you.
Comments
Post a Comment