abhishek
abhishek

Reputation: 1434

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 

Upvotes: 1

Views: 806

Answers (3)

abhishek
abhishek

Reputation: 1434

I acheived this by overriding getView method in cursor adapter and implementing onclicklistener for a view. Thanks guys for suggestions

Upvotes: 1

ShineDown
ShineDown

Reputation: 1879

You must have used an adapter..If u have an Listener there..Then setOnItemClickListener wont work.

Upvotes: 0

Daniel
Daniel

Reputation: 577

Are you in debug mode?

Log.d(string,string)

works in debug mode. Eventually try:

Log.w("","")

.

Upvotes: 0

Related Questions