Android percent field field fill too much -


in android app finding percent of 2 other counters code

double total1 =  counter + counter1; double totaal2 = counter / total1 * 100.0;             percentfield.settext("" + total2); 

my codes work great when percent field showing 50%, 25% etc. showing 33.33333333333% there way, short down percent field showing 33.3

edit have short down code under layout.xml

android:maxlength="3"  

try this:

    totaal2  = totaal2  * 10;     totaal2  = math.round(totaal2 );     totaal2  = totaal2  / 10; 

Comments

Popular posts from this blog

c++ - protocol buffers - generate NON-inline accessors -

c# - issue attaching/adding an entity object which is detached from the DB Context? -