You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a problem with using the ArrayAdapter and the onTouch event in my Android application.
I would need that when pressing a button contained in the displayed row, the list is updated without losing the onTouch event.
This is my code:
public class SlotsItemAdapter extends ArrayAdapter<SlotItem> {
private Button slotPTT = null;
...
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
...
slotPTT.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ResourceAsColor")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
// During the pression of button I need to change the button following an external event
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
// This action is not performed, but I get the MotionEvent.ACTION_CANCEL
}
}
});
}
}
During the pression of button slotPTT I need to change the background color following an external event.
I set the modify in the model and I call "notifyDataSetChanged" that refresh all the view called getView.
The getView metod refresh all the component and also the onTouch event causing the lost the focus and the event ActionUp don't fire.
I haven't been able to solve the problem for a few days. Do you have any ideas about it?
Thank you.
Michele
The text was updated successfully, but these errors were encountered:
Hi, I have a problem with using the ArrayAdapter and the onTouch event in my Android application.
I would need that when pressing a button contained in the displayed row, the list is updated without losing the onTouch event.
This is my code:
During the pression of button slotPTT I need to change the background color following an external event.
I set the modify in the model and I call "notifyDataSetChanged" that refresh all the view called getView.
The getView metod refresh all the component and also the onTouch event causing the lost the focus and the event ActionUp don't fire.
I haven't been able to solve the problem for a few days. Do you have any ideas about it?
Thank you.
Michele
The text was updated successfully, but these errors were encountered: