Open ghost opened 6 years ago
It would be something like this:
mView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { deleteUser(user); /* TODO: add dialog new AlertDialog.Builder(context) .setTitle("Delete Friend") .setMessage("Are you sure want to delete " + user.getName() + "?") .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); deleteUser(user); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).show();*/ return true; } }); } } private void deleteUser(final User user) { mAdapter.remove(user); mFriendsDbRef.child(user.getUid()).removeValue(); }
It would be something like this: