Jarrod Barfield Jarrod Barfield - 1 year ago 63
Android Question

App crash when I submit a new post to Parse

This is the only Place my app crashes and one of the more important features

The LogCat tells me:

java.lang.IllegalArgumentException: You must create this type of ParseObject using ParseObject.create() or the proper subclass.
at line 37.

I tried the
however that just caused more problems (I may have done it incorrectly). How Should I code this?

Here is my newPost class:

public class newPost extends Activity {

private Button addButton;

private TextView postView;

public void onCreate(Bundle savedInstanceState) {

postView = ((EditText) findViewById(R.id.postView));

addButton = ((Button) findViewById(R.id.addButton));
addButton.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
//line 37 Below
ParseObject post = new ParseObject("Posts");
post.put("content", postView);
post.saveInBackground(new SaveCallback () {

public void done(ParseException e) {
if (e == null) {
} else {
"Error saving: " + e.getMessage(),




Answer Source

Replace this line

ParseObject post = new ParseObject("Posts");

with this

ParseObject post = ParseObject.create("Posts");