Number formatting does not take into account locale settings. Consider using String.format instead android studio -


here question , solution regarding problem..

em trying pass textview value between different activities, , em getting problem. when execute code, app crashes on opening studentactivity, shows correct result..here code

loginactivity.java

    int = integer.parseint(textview.gettext().tostring());     intent = new intent(loginactivity.this, studentactivity.class);     i.putextra("level", a);     startactivity(i); 

studentactivity.java

      textview.settext(integer.tostring(getintent().getextras().getint("level"))); 

in studentactivity, integer.tostring(getintent().getextras().getint("level")) => line says number formatting not take account locale settings. consider using string.format instead.please suggest code.. truely appreciated!!

regarding warning :

"number formatting not take account locale settings. consider using string.format instead android studio",

this lint warning called "textview internationalization" says :

when calling textview#settext * never call number#tostring() format numbers; not handle fraction separators , locale-specific digits properly. consider using string#format proper format specifications (%d or %f) instead.

so should have written :

 textview.settext(string.format("%d", getintent().getextras().getint("level")))); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -