android-number-picker

Passing number from 1st activity to the number picker

荒凉一梦 提交于 2019-12-02 10:05:35
This is my 1st activity public void onClick(View v) { switch (v.getId()) { case R.id.setButton: int cpv= carbPValue; int ppv = proteinPValue; int fpv=fatPValue; Intent intent = new Intent ( this, AdjustMacronutrients.class ); intent.putExtra ( "carbP", cpv ); intent.putExtra ( "proteinP", ppv ); intent.putExtra ( "fatP", fpv ); startActivity(intent); finish(); } } This is my 2nd activity : I have 3 integer value pass from 1st activity which is cpv , ppv , fpv . How can i set those value inside the number picker as default, before user pick the number. And show the number in the TextView after

Android NumberPicker with Formatter doesn't format on first rendering

a 夏天 提交于 2019-11-27 12:39:08
I have a NumberPicker that has a formatter that formats the displayed numbers either when the NumberPicker spins or when a value is entered manually. This works fine, but when the NumberPicker is first shown and I initialize it with setValue(0) the 0 does not get formatted (it should display as "-" instead of 0). As soon as I spin the NumberPicker from that point on everything works. How can I force the NumberPicker to format always - Both on first rendering and also when I enter a number manually with the keyboard? This is my formatter public class PickerFormatter implements Formatter {

Android NumberPicker with Formatter doesn't format on first rendering

笑着哭i 提交于 2019-11-26 16:05:54
问题 I have a NumberPicker that has a formatter that formats the displayed numbers either when the NumberPicker spins or when a value is entered manually. This works fine, but when the NumberPicker is first shown and I initialize it with setValue(0) the 0 does not get formatted (it should display as "-" instead of 0). As soon as I spin the NumberPicker from that point on everything works. How can I force the NumberPicker to format always - Both on first rendering and also when I enter a number