Jamal
Jamal

Reputation: 976

OnItemLongClickListener in gridview is not working

In my project, I am enabling the movement of items in gridview(Like dragging or reordering) when Items LongCLick. For that i used code from this reference.

When i Long press the items in gridview , OnItemLongClickListener is not being called. In reference code, it works fine. But when i implement this in my code,its not working. so anyone please suggest me a better solution to correct this issue or else provide any code snippet to move a items in gridview.

Setting in Adapter :

assignmentGridView.setAdapter(new CheeseDynamicAdapter(getApplicationContext(),bulletines ,2));

OnItemLongClickListener:

assignmentGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                    assignmentGridView.startEditMode();
                    return false;
            }
        });

Upvotes: 1

Views: 864

Answers (2)

Piyush
Piyush

Reputation: 18933

If you are using custom adapter and inflate custom layout file then set this properties

  android:focusableInTouchMode="false"
  android:focusable="false"

for your all UI elements.

Upvotes: 1

Mobility
Mobility

Reputation: 263

Set

assignmentGridView.setLongClickable(true);

Upvotes: 0

Related Questions