1

I hope that someone can help me :)

I have FragmentCategory, where where I change, which places will be shown in GridView.

I have always OnClick, but when I have fragment "pending", I want to have also LongClick -> Then I will show MaterialDialog

My OnClick:

        adapter = new AdapterPlaceGrid(getActivity(), items);
    adapter.setOnItemClickListener(new AdapterPlaceGrid.OnItemClickListener() {
        @Override
        public void onItemClick(View v, Place p) {
            ActivityPlaceDetail.navigate((ActivityMain) getActivity(), v.findViewById(R.id.image), p);
        }
    });
    recyclerView.setAdapter(adapter);

Can someone tell me, how can I make LongClick?

Thanks :)

enter image description here

mousik
  • 101
  • 1
  • 11

1 Answers1

1

I think you could use

adapter.setOnItemLongClickListener(new AdapterPlaceGrid.OnItemLongCLickListener(){
@Override
    public void onItemLongClick(View v, Place p) {
        ....
    }
});

See this link https://developer.android.com/reference/android/widget/AdapterView.OnItemLongClickListener.html

joao86
  • 2,056
  • 1
  • 21
  • 23