I've a Spinner and its content depends on actual location (GPS position). So the content should changes continually, but it's only visible to the user when he/she selects an item. Instead of having a thread who continually updates the Spinner content, or a button to force an update from the user, I'd like to obtain another behaviour. When the user touches the Spinner, before the Spinner opens, it should be updated. I'm already able to change programmatically the Spinner's content. What I need is an event that triggers when the user touch the closed Spinner, but before the opened Spinner is shown. I hope this question is clear enough. Thank you for you attention.
You can use onTouchListener
spinner.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
// Load your spinner here
}
return false;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With