【发布时间】:2019-07-21 05:37:26
【问题描述】:
首先,我有一个页面供用户将他们的帐户注册到 firebase。他们必须输入他们的姓名、ID、电子邮件和密码。然后电子邮件将在 Firebase 身份验证中注册,名称、ID、电子邮件将保存在 Firebase 数据库中。现在,我尝试同时删除用户数据并删除身份验证。假设我以管理员身份登录,我想删除图像中附加的数据,如何同时删除选定的用户数据库和身份验证?
**PS:数据显示在列表视图中,长按选择要删除的用户。
这是我的代码。
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ActivityAdminPage.this);
alertDialog.setTitle("Are You Sure?");
alertDialog.setMessage("Delete the User and the User will not longer able to Login to the " +
"System anymore.");
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DatabaseReference databaseR = FirebaseDatabase.getInstance().getReference("User");
databaseR.removeValue();
}//end of YES Button Click
});
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do ntg
}
});
alertDialog.create();
alertDialog.show();
return true;
}//End of Long Click
【问题讨论】:
标签: java firebase-realtime-database firebase-authentication