用debug调试了 onSuccess()方法,onFailure()方法都不进去
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.initView();
Bmob.initialize(MainActivity.this, "07b317e9aea31108e6a10167da0448a7");
}
private void initView() {
mName = (EditText) findViewById(R.id.name);
mFeedback = (EditText) findViewById(R.id.feedback);
mSubmit = (Button) findViewById(R.id.submit);
mSubmit.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
if (arg0.getId() == R.id.submit) {
submit11();
}
}
public void submit11() {
String name = mName.getText().toString();
String feedback = mFeedback.getText().toString();
if ("".equals(name) || "".equals(feedback)) {
return;
}
// 保存数据
FeedBack feedBackObj = new FeedBack();
feedBackObj.setName(name);
feedBackObj.setFeedback(feedback);
feedBackObj.save(MainActivity.this, new SaveListener() {
@Override
public void onSuccess() {
Toast.makeText(MainActivity.this, "submit is sucess",
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int arg0, String arg1) {
Toast.makeText(MainActivity.this, "submit is failure",
Toast.LENGTH_SHORT).show();
}
});
}