Back to project page ExpertAndroid.
The source code is released under:
MIT License
If you think the Android project ExpertAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.iuriio.demos.expertandroid.ch13parsesimple; /*from w ww. j a va 2 s .com*/ import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import com.parse.ParseUser; import com.parse.SaveCallback; import java.util.List; public class MainActivity extends BaseActivity { private static final String TAG = "MainActivity"; public MainActivity() { super(TAG); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.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. switch (item.getItemId()) { case R.id.action_settings: return true; } return super.onOptionsItemSelected(item); } private void populateUserNameList() { ParseQuery<ParseUser> query = ParseUser.getQuery(); this.turnOnProgressDialog("Going to get users", "Patience. Be right back"); query.findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> users, ParseException e) { turnOffProgressDialog(); if (e == null) { successGettingUsers(users); } else { errorGettingUsers(e); } } }); } private void successGettingUsers(List<ParseUser> users) { // ? } private void errorGettingUsers(ParseException e) { this.setErrorView(e.getMessage()); } private void setErrorView(String message) { } public void createWord(View v) { if (this.validateForm() == false) { return; } final String word = this.getWord(); final String meaning = this.getMeaning(); final Word wordObject = new Word(word, meaning); this.turnOnProgressDialog("Saving word", "We will be right back"); wordObject.getParseObject().saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { turnOffProgressDialog(); if (e == null) { wordSavedSuccessfully(); } else { wordSaveFailed(e); } } }); } private String getMeaning() { return null; } private String getWord() { return null; } private void wordSavedSuccessfully() { this.gotoActivity(WordListActivity.class); this.finish(); } private void wordSaveFailed(ParseException e) { String error = e.getMessage(); this.alert("Saving word failed", error); } }