android - Calculated value based on seekbar not displayed in textview -


i have 2 seekbars , based on value i'm doing math , putting result in textview. when i'm changing seekbar's progress, textview "blinking", normal, suppose, value removed , new inserted. installing code on emulator, in cases calculated value disappears after releasing seekbar. after putting code on device, value isn't displayed anymore. can problem be? here code:

weight = weightseekbar.getprogress(); height = ((double) heightseekbar.getprogress()) /100; double bmi = weight/(height*height); bmivaluetext.settext("bmi value: " + bmi); log.d(tag,"weight= " + weight + " height= " + height + " bmi = " + bmi); 

note: "bmi value" text displayed after each change. code implemented in seekbar listener's

 public void onprogresschanged(seekbar seekbar, int i, boolean b) 

method.

the textview might not wide enough values longer decimal representations, causing text disappear. can limit number of digits after decimal point fits (using string.format(), example).


Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -