Luiz Henrique Ugliano
Luiz Henrique Ugliano

Reputation: 1317

Android app does not send the TestObject to parse

I developed an app that uses some parse functionality and i need to develop a new project. I performed all the necessary steps to parse and not being able to send the TestObject. The app does not return any error but after running the project, TestObject can not be viewed in the parse. I downloaded the entire project right through parse, so it comes with all the necessary settings. Does anyone have any ideas?

ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();

MainActivity

package com.parse.starter;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.parse.ParseAnalytics;
import com.parse.ParseObject;

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

ParseAnalytics.trackAppOpenedInBackground(getIntent());

  ParseObject testObject = new ParseObject("TestObject");
  testObject.put("foo", "bar");
  testObject.saveInBackground();

  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.menu_main, menu);
  return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  // Handle action bar item clicks here. The action bar will
  // automatically handle clicks on the Home/Up button, so long
  // as you specify a parent activity in AndroidManifest.xml.
  int id = item.getItemId();

  //noinspection SimplifiableIfStatement
  if (id == R.id.action_settings) {
  return true;
  }

  return super.onOptionsItemSelected(item);
  }
  }

strings.xml

<resources>
<string name="parse_app_id">qAoCmj2HQWmgdjy32yOgQnNZyIEkcQsXFCH1CVvc</string>
<string name="parse_client_key">tCONitHRAJYckjLZeNIn7kGFsVnbXqBrZdaAU9ZT</string>

<string name="app_name">TwitterApp</string>

<string name="hello_world">Hello World!</string>
<string name="action_settings">Settings</string>
</resources>

enter image description here

enter image description here

First project that ok to send TestObject

enter image description here

Upvotes: 0

Views: 86

Answers (2)

Luiz Henrique Ugliano
Luiz Henrique Ugliano

Reputation: 1317

For those who have the same problem, after several attempts, I managed to solve simply. Removed the app directly on the emulator and ran the project again.

It worked.

enter image description here

Upvotes: 1

makasujan
makasujan

Reputation: 83

Have you checked if the save operation has thrown any exceptions? You can try:

testObject.saveInBackground(new SaveCallback() {
  public void done(ParseException e) {
    if (e != null) {
      e.printStackTrace();
    }
  }
});

Upvotes: 0

Related Questions