Friday, 15 January 2010

android - EditText with number input only returns 0 as string -



android - EditText with number input only returns 0 as string -

i have edittext accepts numerical input , using next code turn input string can utilize later.

scorestring = integer.parseint(teamscore.gettext().tostring());

the problem is... when utilize settext(), says "0" in:

previewtext.settext( scorestring + " :");

why won't integer user set in edittext?

edit: if i'm using settext ton of strings (6-8 strings in it), disrupt ability utilize number in there?

-i collected final chunk of strings , made them 1 whole string, used settext finaloutput , didn't work (see below)

finaloutput = (sportname + ": " + team1namestring + " " + team1scorestring + ", " + team2namestring + " " + team2scorestring + " - " + quarterstring + " " + descriptionstring); generatepreview.settext(finaloutput + "");

(sorry maintain changing variable names, pay attending format)

hmm, can confirm next works way sounded wanted (meaning if come in "65" in editview, outputs "65 :" in textview):

edittext meditview = (edittext)findviewbyid(r.id.myedittext); textview mtextview = (textview)findviewbyid(r.id.mytextview); int scorestring = integer.parseint(meditview.gettext().tostring()); mtextview.settext(scorestring + " :");

is setup same?

android android-edittext gettext tostring settext

No comments:

Post a Comment