• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps OnItemClickListener Not Working

assistant

Lurker
Hi,

Problem is that onItemClickListener it's not working and it's not throwing any exceptions.

My code looks something like this:

Code:
....
 
// Connect to database
 
// Fill up the cursor 
 
....
 
 
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]textView[/COLOR][/SIZE]
[LEFT][/COLOR][/SIZE][SIZE=2]= (AutoCompleteTextView) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]autocomplete_users[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]adapter[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SimpleCursorAdapter([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]list_item[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], cursor, from, to);[/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]adapter.setCursorToStringConverter(.....[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000c0][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0]adapter.setFilterQueryProvider(...[/COLOR][/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0]adapter.setViewBinder(...[/COLOR][/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0]textView.setAdapter(adapter);[/COLOR][/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0]textView.setOnItemClickListener(...[/COLOR][/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#0000c0]...[/COLOR][/SIZE][/LEFT]
[/COLOR][/SIZE]

The items(sugestions) in a autocomplete drop down list are generated dinamically, based on entered search criteria.​

When certain item gets clicked nothing happens. :confused:

Any sugestions?​

Best regards.​
 
Hi Alostpacket,

Thanks for your try.

The solution is to set OnItemClickListener under onStart() method not under onCreate(). Why is that so, I don't know yet but it's working. ;)
 
no problem, that's pretty weird though. I mean theorectically you should be able to set and change listeners whenever you need to. It's the whole "de-coupling" idea behind having a separate listener in the first place...

Strange.


Glad it's working for you though :)
 
Back
Top Bottom