Вопрос

I have a custom listView defined like this

public class DDListView extends ListView implements OnScrollChangedListener {

than I make an instance of it with name mExampleList I set onLongClickListener but it never get called, where is my problem ?

mExampleList.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            // TODO Auto-generated method stub
            Log.v("vvv", "sdfsdf");
            return false;
        }
    });
Это было полезно?

Решение

I think you want to be using OnItemLongClickListener instead of OnClickListener.

Другие советы

Mmmmm , are you trying to make all ListView longclckeable?

Some tips:

-Try first to see if normal OnClick gets fired;

-Try to see if you have setClickeable(true); on it;

-Try to see if you are really trying to do that and not an usual onItemClick() of the items in the list (to do this @override the function :
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {}

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top