P
P
paleniy2017-07-11 20:54:12
Android
paleniy, 2017-07-11 20:54:12

How to listen for simultaneous clicks on two GridView items?

There is a GridView, items - textView. I listen to clicks on items. But with simultaneous or very fast clicking on different items, only one click works. How can you catch both clicks? OnTouchListener to hang up on items?

...
 @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTheme(R.style.AppTheme);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Grid.setOnItemClickListener(gridViewOnItemClickListener);
....
    private GridView.OnItemClickListener gridViewOnItemClickListener = new GridView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                Grid.getChildAt(position).setBackgroundColor(parseColor("#FFFFFF"));
        }
    };

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question