gpt4 book ai didi

android - 如何从 Parse.com 中删除整行并用新数据更新它

转载 作者:搜寻专家 更新时间:2023-10-30 23:45:56 29 4
gpt4 key购买 nike

删除代码

            DeleteDetails.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final ParseObject Details = new ParseObject("Details");

ParseUser user = ParseUser.getCurrentUser();
Details.put("User", user);

Details.remove("Age");
Details.remove("Email_Address");
Details.remove("Location");
Details.remove("FullName");

Details.saveInBackground();

}
});

我已经创建了上面的代码,它从 Parse 上的表中删除了数据,但是它会自动创建一个新字段。我希望能够输入数据,将其删除并再次输入。一旦用户退出应用程序并返回到它,数据将从云端获取并显示在 TextViews 中。

TextView 代码

ParseQuery<ParseObject> requestAge = ParseQuery.getQuery("Details");
requestAge.getFirstInBackground(new GetCallback<ParseObject>() {

public void done(ParseObject reqDetails, ParseException e) {
if (reqDetails != null) {
Log.d("reqDetails", "Got it");
//Retrieve Age
String gettheAge = reqDetails.getString("Age");
EditText displayAge = (EditText)findViewById(R.id.ageET);
displayAge.setText(gettheAge);

//Retrieve E-mail address
String gettheEmail = reqDetails.getString("Email_Address");
EditText displayEmail = (EditText)findViewById(R.id.EmailET);
displayEmail.setText(gettheEmail);

//Retrieve Location:
String gettheLocation = reqDetails.getString("Location");
EditText displayLocation = (EditText)findViewById(R.id.LocationET);
displayLocation.setText(gettheLocation);

//Retrieve Name:
String gettheName = reqDetails.getString("FullName");
EditText displayName = (EditText)findViewById(R.id.NameET);
displayName.setText(gettheName);

Toast.makeText(getApplicationContext(),
"Successfully Recieved Personal Details",
Toast.LENGTH_LONG).show();

} else {
Log.d("reqAge", "Empty_query");


Toast.makeText(getApplicationContext(),
"Can't Get Details, Check Connection", Toast.LENGTH_LONG)
.show();
}
}
});

最佳答案

如果要在 Parse 中删除对象,只需对要删除的对象调用 deleteInBackground 方法即可。

Android Parse Docs

关于android - 如何从 Parse.com 中删除整行并用新数据更新它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28594133/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com