Android Intent issue -
i want show details of calculation in activity when click on button. how achieve this. first activity java code is
public void onclick(view v) { if(v.getid()==r.id.button07) { intent intent=new intent(advancedcalculator.this,calculateddata.class); startactivity(intent); }
the calculation want is
string a,b; integer vis; = txtbox3.gettext().tostring(); b = textview1.gettext().tostring(); vis = (integer.parseint(a)*integer.parseint(b))/100; tv.settext(vis.tostring());
i want result 'tv' shown in next activity when press submit button. need include calculation.and further steps
any appreciated thanks
in first activity:
public void onclick(view v) { //put calculation code here bundle b = new bundle(); b.putstring("answer", youranswer); //you use putinteger, whichever prefer. intent intent=new intent(advancedcalculator.this,calculateddata.class); intent.putextras(b); startactivity(intent); }
in second activity, in oncreate put this:
bundle b = getintent().getextras(); string answer = b.getstring("answer");
answer key. used identify want bundle. using unique keys means can pass more 1 value next activity, if want.
Comments
Post a Comment