Getting text from a EditText Field. And attempting to set it to a new CloudObject. But Nothing happens when i click the Button.
btnUpdteStts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String caption = edtxtPost.getText().toString().trim();
final CloudObject obj = new CloudObject("Status");
try {
obj.set("Cap",caption);
} catch (CloudException e) {
e.printStackTrace();
}
try {
obj.save(new CloudObjectCallback() {
@Override
public void done(CloudObject x, CloudException t) throws CloudException {
if(x!=null) {
Intent goHome = new Intent(Post.this, HomeRoom.class);
startActivity(goHome);
}
}
});
} catch (CloudException e) {
e.printStackTrace();
Toast.makeText(Post.this,"Problem",Toast.LENGTH_LONG).show();
}
}
});
You seem not to have handled the case in the callback where x==null
in which case exception t!=null
. Print the exception message and you should be able to see the problem.