1

Is it possible to make a single row of listview not clickable?

I am making a course search dialog which contains a listview. And when the user click the item in the listview, the course will be automatically added to the database. I want to make the courses which already exist in the database, not clickable, or simply not display the row. How can I do that?

Thanks

P.S. The adapter I used for the listview a customized BaseAdapter.

kevin
  • 807
  • 3
  • 11
  • 20
  • 1
    Are you able to check to see if the item is already in the database, if so you can ignore the click event. To not show the item at all adjust your query so the undesired item does not appear in your query. – Dan S Nov 30 '11 at 23:44
  • i am querying the course result from a website rather than my local database. so the course information is not in the database before the user click the item. I can know whether the course if the course is already in the database after the web query finishes. – kevin Nov 30 '11 at 23:49
  • what should I do with the adapter if i want to hide item? – kevin Nov 30 '11 at 23:57
  • 1
    In your BaseAdapter if you make AreAllItemsEnabled false you can set isEnabled(int position) to enable selected items This is similar to question [How to disable items in a List View?](http://stackoverflow.com/questions/2662358/how-to-disable-items-in-a-list-view) – sparksalot Nov 30 '11 at 23:57
  • You'll have to wait until the web query finishes, also sparksalot has a great reference there. – Dan S Dec 01 '11 at 00:04

0 Answers0