i\'m using slide to delete from recyclerview but the problem comes when getAdapterPosition() doesn\'t match with the row_id of sql table. how can i get id from the adapter a
Use the getItemId
method if you have overridden it in yr adapter like so
@Override
public long getItemId(int position) {
return yrModel.getId();
}
yrViewHolder.idTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Long id = yrList.get(position).getId();
Log.e(TAG, "List item ID: " + id);
}
});
That way u get the item position and the ID using the getItemId method