I'm trying to get the value from Android SpinnerWheel. There are very few post in SO giving answer for this and not one post shows any true information. I found only one link which was a bit descriptive but still didn't have the result I wanted. So if anyone can show me how exactly we can get the value and set it in a TextView, it will be really great
My Code
public class MainActivity extends Activity {
TextView textvalue;
String value;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textvalue = (TextView)findViewById(R.id.textvalue);
final AbstractWheel mins = (AbstractWheel) findViewById(R.id.mins);
NumericWheelAdapter minAdapter = new NumericWheelAdapter(this, 0, 59, "%02d");
minAdapter.setItemResource(R.layout.wheel_text_centered_dark_back);
minAdapter.setItemTextResource(R.id.text);
mins.setViewAdapter(minAdapter);
//OnWheelChangedListener listener = null;
//mins.addChangingListener(listener);
}
private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
public void onChanged(AbstractWheel wheel, int oldValue, int newValue) {
String value = String.valueOf(newValue);
textvalue.setText(value);
}
};
}
.