1. Are you ready for the Galaxy S20? Here is everything we know so far!

listview: onItemClickListener is not called

Discussion in 'Android Development' started by krish.chauhan, Dec 27, 2009.

  1. krish.chauhan

    krish.chauhan Lurker
    Thread Starter

    Hi ,

    My OnItemClickListener is not called when i set it on list view. What can be the possible reason.

    Following is the code for same.
    public void updateList(){
    view =(ListView)findViewById(R.id.listv);
    // view.setDescendantFocusability(ListView.FOCUS_AFTER_DESCENDANTS);
    // view.setOnKeyListener(this);
    // view.setDrawingCacheEnabled(false);
    // view.setSelectionAfterHeaderView();
    // view.setScrollingCacheEnabled(false);
    // view.setBackgroundColor(Color.WHITE);
    Vector<RSSItem> messages = PersistanceHandler.getItems();

    if (messages.size() > 0) {
    messages.elementAt(selectedIndex).setFocused(true);
    }

    ArrayList<RSSItem> msglist = new ArrayList<RSSItem>();
    // int size = messages.size();
    int start=currentPageIndex*ITEM_PER_PAGE;
    int end=((start+ITEM_PER_PAGE+1) <messages.size())?(start+ITEM_PER_PAGE+1):messages.size();

    for (int i = start; i < end; i++) {
    msglist.add(messages.elementAt(i));
    }
    view.setClickable(true);
    try{
    view.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(AdapterView<?> parent, View view, int position, long rowID) {
    if(view instanceof InboxAdapterView){
    Log.d("Click"," krishan");
    }

    }
    });

    }catch(Exception ex){
    System.out.println("nothing");
    }
    inbox = new InboxAdapter(Home.this, msglist);
    view.setAdapter(inbox);
    Log.d(" rent a coder ",""+ view.getOnItemClickListener());
    }
     


Loading...
Similar Threads - listview onItemClickListener called
  1. faran100
    Replies:
    0
    Views:
    352
  2. ElChief
    Replies:
    1
    Views:
    206
  3. Ponnangan
    Replies:
    0
    Views:
    394
  4. LefmyHans
    Replies:
    0
    Views:
    251
  5. Nightpoison
    Replies:
    1
    Views:
    335
  6. maneeshalampalli
    Replies:
    2
    Views:
    301
  7. maneeshalampalli
    Replies:
    4
    Views:
    809
  8. Mingi
    Replies:
    0
    Views:
    267
  9. Hallo91
    Replies:
    0
    Views:
    932
  10. skyline220
    Replies:
    0
    Views:
    499

Share This Page

Loading...