List View onItemclickListener not working
I have a ListView whose id is android:id="@android:id/list"
and i have a custom cursor Adapter in which i inflate my custom Linear Layout My custom LinearLayout has an image view on left side and textview on right side
I am able to populate the data on the list view but i am not able to get setonItemClickListener working
PlaylistScreen.this.lv = getListView();
MusicCursorAdapter musicCursor = new MusicCursorAdapter(PlaylistScreen.this, cursor, tracks);
//PlaylistScreen.this.setListAdapter(musicCursor);
PlaylistScreen.this.lv.setAdapter(musicCursor);
PlaylistScreen.this.lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Log.d("Item Click","+++++++++");
开发者_开发技巧 })
})
but i am not able to get this in logcat
I acheived this by overriding getView method in cursor adapter and implementing onclicklistener for a view. Thanks guys for suggestions
Are you in debug mode?
Log.d(string,string)
works in debug mode. Eventually try:
Log.w("","")
.
You must have used an adapter..If u have an Listener there..Then setOnItemClickListener wont work.
精彩评论