I am creating an android application to save the passwords. On the main screen i am using recycler view to show all the passwords. I have 2 two buttons one to add new password and second to update the password, when the user clicks on add new password, new activity (add new password activity) will be open. how should i reload the recycler view on the main screen after returning from the add new password activity?
i tried to recall the initial recyclerview function but it didn't worked.
addData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// action to be performed after it was clicked;
Intent i = new Intent(MainScreen.this, AddNewPassword.class);
i.putExtra("id", (String) null);
i.putExtra("Platform", "");
i.putExtra("User", "");
i.putExtra("password", "");
i.putExtra("boolean", false);
startActivity(i);
}
});
how should i refresh the current screen after returning fromm the AddNewPassword activity ?
CodePudding user response:
Call notifyDataSetChanged after making changes:
adapter.notifyDataSetChanged()
CodePudding user response:
while comming back to first you have to override onResume method and in that method you have to bind that recyclerAdapter and last call.
adapter.notifyDataSetChanged()