How to block an item from a listview?

Asked

Viewed 215 times

2

I have a list of Textview in a Listview, and by clicking on one of the Textview I have access to a Fragment.
How do I stop, when I’m in one Fragment, the Textview responsible for opening it is blocked? Therefore, the application will not be forced to open the same Fragment repeatedly!

  • The question is a little confused. Is this what you are looking for: textView.setEnabled(false); ?

  • I want to avoid that the user can double click on the same listview item, no matter it’s a textview... In my case it is simply a String Arraylist!

  • If I’m not mistaken, the BaseAdapter has a method that you can override and tell if the item is enabled, take a look at the method isEnabled. I think he’ll do what he needs.

1 answer

1


Use java view.setClickable(Boolean.FALSE); within the onClick method of your listview:

    listView.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> arg0, View rootView, int pos, long id) {
        // hard processing
        ...
        rootView.setClickable(Boolean.FALSE);
        ...
       // More hard processing
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.