I'm working with the detail master pattern, when I'm in landscape mode the list and detail is displayed (it should be noted that in the detail you could call a fragment that contains the logic to add a new record), that's where it goes the problem when you delete a record in landscape mode, it shows the deleted message but it does not update the recyclerview items, like when I'm on a smartphone to see the detail I open another activity that contains the detail where I have the option to delete the registration but when I return the record is still on the list.
Also how to get the position of the item removed from the activity
This is the function found on the adapter.
void deleteItem(int index) {
mDataset.remove(index);
notifyItemRemoved(index);
}
in the click event of the delete button that is in the activity
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.bt_eliminar:
if(mFragment != null){
//Como obtener la posicion del recyclerview - este número es solo de ejemplo
mFragment.eliminar(1);
}
break;
}
}
How can I get the position for the delete function, from the activity.
I would like you to give me an explanation of how to achieve this goal.
This is my first question about this problem update items from recyclerview , I leave the code I have achieved with the help of David a great developer.
Code hosted on Gist GitHub