package com.example.root.sportdb;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import com.parse.*;
import com.parse.ParseObject;
public class MainActivity extends ActionBarActivity {
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Parse.enableLocalDatastore(this);
Parse.initialize(this, "lG75j5BVA3Y7K7HubpV2wMC3D5sJ9cP2mQnryYUy", "Ht2LOvXISgvZkaoMl1WQRzFup4NkF2GznKSO7j3D");
addListenerOnButton();
}
public void addListenerOnButton() {
button = (Button) findViewById(R.id.btnPush);
button.setOnClickListener(new OnClickListener() {
EditText id,name,email,phone;
@Override
public void onClick(View arg0) {
ParseObject testObject = new ParseObject("TestObject");
id = (EditText) findViewById(R.id.txtID);
name = (EditText) findViewById(R.id.txtName);
email = (EditText) findViewById(R.id.txtEmail);
phone = (EditText) findViewById(R.id.txtPhone);
testObject.put("ID",id);
testObject.saveInBackground();
}
});
}
}
嘿我不熟悉通过Android SDK应用程序进行Parse集成,尝试将ID,名称,电话和电子邮件保存到我的解析数据类之一。每当我运行这个应用程序testObject.put(“ID”,id); appplication抛出错误“Unfortnatley application failed ok”,解析数据在解析数据上显示为空白。
答案 0 :(得分:0)
您应该尝试保存String而不是EditText。
testObject.put("ID",id.getText().toString());