I’m having trouble getting past the basics of having my app communicate with a server to store data.
I’m attempting to use Parse (https://parse.com/) as the backend of the Android app I’m working on. I got the basic “Quick Start” Parse app going fine, and was able to upload data from the app on my phone to my Parse account using the onCreate() method. Then I tried to create an app which would upload some data when a button is pressed. I can install and run the app, but when I press the button nothing seems to happen, and when I then check my Parse account no data has been uploaded. I included the Parse libs and added them to the build path.
Here is the app code-
package greg.mariani.saveLoad;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.parse.Parse;
import com.parse.ParseObject;
public class SaveLoad1Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Parse.initialize(this, "private_app_token1", "private_app_token2");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void saveUpdates(View view) {
ParseObject updates = new ParseObject("Updates");
updates.put("court", "Brentwood Rec");
updates.put("update", "Game On");
updates.saveInBackground();
}
}
Here is the layout xml-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
android:onClick="saveUpdates"/>
</LinearLayout>
Can anyone see what I’m doing wrong?
have you added internet permission to your manifest file?