Skip to content Skip to sidebar Skip to footer

Getting Problem In Sending Data From Recyclerview Adapter To A New Activity

After doing many hit and try method and observing other stackoverflow code, I was able to send data to next activity. I want to know: Is it safe to call cursor.moveToPosition twice

Solution 1:

This is not a correct way to use cursor in recycler adapter however this is a solution for you to send current title to the next activity.

write below code in your onclick listener

    songCursor.moveToPosition(position);
    String title= songCursor.getString(songTitleIndex);
    Intent intent = newIntent(callingActivity.this,SongPlaying.class);
    intent.putExtra("mayank", "" + title);
    callingActivity.startActivity(intent);

Post a Comment for "Getting Problem In Sending Data From Recyclerview Adapter To A New Activity"