本文整理匯總了Java中com.parse.SaveCallback類的典型用法代碼示例。如果您正苦於以下問題:Java SaveCallback類的具體用法?Java SaveCallback怎麽用?Java SaveCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SaveCallback類屬於com.parse包,在下文中一共展示了SaveCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: send
import com.parse.SaveCallback; //導入依賴的package包/類
protected void send(ParseObject message) {
message.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
// success!
Toast.makeText(RecipientsActivity.this, R.string.success_message, Toast.LENGTH_LONG).show();
sendPushNotifications();
}
else {
AlertDialog.Builder builder = new AlertDialog.Builder(RecipientsActivity.this);
builder.setMessage(R.string.error_sending_message)
.setTitle(R.string.error_selecting_file_title)
.setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.create();
dialog.show();
}
}
});
}
示例2: saveMethod
import com.parse.SaveCallback; //導入依賴的package包/類
private void saveMethod(){
//will save the data
if(dateText.getText().toString().equals("") || dateText.getText().toString().equals(" ") || dateText.getText() == null){ //but before saving we will make sure that date is there
Toast.makeText(getApplicationContext(), "Attendance date is required",Toast.LENGTH_SHORT).show();
// Snackbar.make(findViewById(R.id.activity_add_attendance),
// "Attendance date is required", Snackbar.LENGTH_SHORT).show();
}else{
List<String> kidsIds = new ArrayList<>();
for (int i = 0; i < adapter.map.size() ; i++) {
if (adapter.map.get(kidArrayList.get(i))){
kidsIds.add(kidArrayList.get(i).getObjectId());
}
}
attendance.setDate(dateText.getText().toString());
attendance.setKidsIds(kidsIds);
attendance.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null){
Toast.makeText(getApplicationContext(),"Saved successfully.",Toast.LENGTH_LONG).show();
end();
}
}
});
}
}
示例3: incrementNumberOfVisits
import com.parse.SaveCallback; //導入依賴的package包/類
private void incrementNumberOfVisits(){
int i;
if(myKid.getNumberOfVisits() == null){
i = 0;
}else{
i = Integer.parseInt(myKid.getNumberOfVisits());}
i++;
myKid.setNumberOfVisits(String.valueOf(i));
myKid.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null){
Toast.makeText(getApplicationContext(),"Saved successfully",Toast.LENGTH_LONG).show();
}else {
Toast.makeText(getApplicationContext(),"Error calculating the number of visits!",Toast.LENGTH_LONG).show();
}
}
});
}
示例4: start
import com.parse.SaveCallback; //導入依賴的package包/類
@Kroll.method
public void start()
{
setState(STATE_RUNNING);
// App opens analytics
ParseAnalytics.trackAppOpenedInBackground(TiApplication.getAppRootOrCurrentActivity().getIntent());
ParseInstallation.getCurrentInstallation().put("androidId", getAndroidId());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e != null) {
Log.e(TAG, "Installation initialization failed: " + e.getMessage());
}
// fire event
try {
JSONObject pnData = new JSONObject();
pnData.put("objectId", getObjectId());
pnData.put("installationId", getCurrentInstallationId());
KrollDict data = new KrollDict(pnData);
module.fireEvent("installationId", data);
} catch (JSONException e1) {
Log.e(TAG, "InstallationId event failed: " + e1.getMessage());
}
}
});
}
示例5: setUpParse
import com.parse.SaveCallback; //導入依賴的package包/類
public static void setUpParse(Context context) {
Parse.enableLocalDatastore(context);
Parse.initialize(context, "SUA_APPLICATION_ID", "SUA CLIENT_KEY");
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParsePush.subscribeInBackground(Constants.CHANNEL, new SaveCallback() {
@Override
public void done(ParseException error) {
if (error == null) {
Log.i(Constants.TAG, "Successfully subscribed to Parse!");
}else{
Log.i(Constants.TAG, "Error subscribed to Parse!");
}
}
});
}
示例6: runUpdate
import com.parse.SaveCallback; //導入依賴的package包/類
private void runUpdate(final Event event, ArrayList<String> locations, String tag) {
Log.d("FAC", tag);
for (String location : locations) {
String venue = event.getVenue();
venue = venue.replaceAll("\n", " ");
event.setVenue(venue);
if (venue.toLowerCase().contains(location)) {
event.setFacultyTag(tag);
event.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
Log.e("Saved:", event.getType());
}
});
break;
}
}
}
示例7: userAcceptedGroup
import com.parse.SaveCallback; //導入依賴的package包/類
private void userAcceptedGroup(Object org){
if(org instanceof String){
final Organization newOrg = new Organization((String)org);
newOrg.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e == null){
//save worked
saveAndContinue(newOrg);
}else{
Toast.makeText(CreateOrganization.this, "Error creating organization, please try again", Toast.LENGTH_SHORT).show();
}
}
});
}else{
saveAndContinue((Organization)org);
}
}
示例8: onCreate
import com.parse.SaveCallback; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
Parse.initialize(this, "b6M7rAxtdYoUgGMgGkzmYmpDWiN2T6M8c2RTJ5Zg", "Xsqyd44kUtgiOMMvwP8gyVjmdZLvXLxuynmGqqNX");
ParsePush.subscribeInBackground("Apro_2016", new SaveCallback() {
@Override
public void done(ParseException e) {
Log.e(TAG, "Successfully subscribed to Parse!");
}
});
Log.d(TAG, "not rgtd.");
}
示例9: getFacebookInfo
import com.parse.SaveCallback; //導入依賴的package包/類
private void getFacebookInfo() {
Bundle parameters = new Bundle();
parameters.putString("fields", "picture, first_name, id");
new GraphRequest(AccessToken.getCurrentAccessToken(), "/me", parameters, HttpMethod.GET, new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {
JSONObject user = graphResponse.getJSONObject();
ParseUser currentUser = ParseUser.getCurrentUser();
currentUser.put("firstName", user.optString("first_name"));
currentUser.put("facebookId", user.optString("id"));
currentUser.put("pictureURL", user.optJSONObject("picture").optJSONObject("data").optString("url"));
currentUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e == null) {
Log.i(TAG, "User saved");
setResult(RESULT_OK);
finish();
}
}
});
}
}).executeAsync();
}
示例10: onItemClick
import com.parse.SaveCallback; //導入依賴的package包/類
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
ImageView checkImageView = (ImageView)view.findViewById(R.id.checkImageView);
if (mGridView.isItemChecked(position)) {
// add the friend
mFriendsRelation.add(mUsers.get(position));
checkImageView.setVisibility(View.VISIBLE);
}
else {
// remove the friend
mFriendsRelation.remove(mUsers.get(position));
checkImageView.setVisibility(View.INVISIBLE);
}
mCurrentUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
Log.e(TAG, e.getMessage());
}
}
});
}
示例11: activateEvent
import com.parse.SaveCallback; //導入依賴的package包/類
private void activateEvent() {
new AlertDialog.Builder(this)
.setTitle(getString(R.string.activate))
.setMessage(getString(R.string.activateConfirm))
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
final ProgressDialog pd = ViewUtils.showProgressDialog(EventDetailActivity.this, getString(R.string.activatingEvent), false);
ParseObject eventParseObject = new ParseObject(Event.EVENT);
eventParseObject.setObjectId(event.getObjectId());
eventParseObject.put(Event.ENABLED, true);
eventParseObject.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {ViewUtils.hideProgressDialog(pd);
Toast.makeText(EventDetailActivity.this,
EventDetailActivity.this.getString(R.string.eventActivatedSuccessfully),
Toast.LENGTH_LONG).show();
finish();
}
});
}
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
示例12: deactivateEvent
import com.parse.SaveCallback; //導入依賴的package包/類
private void deactivateEvent() {
new AlertDialog.Builder(this)
.setTitle(getString(R.string.deactivate))
.setMessage(getString(R.string.deactivateConfirm))
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
final ProgressDialog pd = ViewUtils.showProgressDialog(EventDetailActivity.this, getString(R.string.deactivatingEvent), false);
ParseObject eventParseObject = new ParseObject(Event.EVENT);
eventParseObject.setObjectId(event.getObjectId());
eventParseObject.put(Event.ENABLED, false);
eventParseObject.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {ViewUtils.hideProgressDialog(pd);
Toast.makeText(EventDetailActivity.this,
EventDetailActivity.this.getString(R.string.eventDeactivatedSuccessfully),
Toast.LENGTH_LONG).show();
finish();
}
});
}
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
示例13: setupParse
import com.parse.SaveCallback; //導入依賴的package包/類
private void setupParse() {
Parse.initialize(this, getString(R.string.parse_app_id), getString(R.string.parse_client_key));
ParseFacebookUtils.initialize(this);
if(ParseUser.getCurrentUser() != null && !UserPreferences.isUserAssociatedWithInstallation()) {
// This should be done only once
ParseInstallation currentInstallation = ParseInstallation.getCurrentInstallation();
currentInstallation.put("user", ParseUser.getCurrentUser());
currentInstallation.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e != null) {
Timber.d("Error when trying to associate user with installation: " + e.getLocalizedMessage());
} else {
Timber.d("User successfully associated with installation");
UserPreferences.setUserAssociatedWithInstallation();
}
}
});
}
}
示例14: removeUserFromRoom
import com.parse.SaveCallback; //導入依賴的package包/類
private void removeUserFromRoom() {
mRoom.getUsers().remove(mCurrentUser);
mRoom.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
setNotRegisteredVisibilityAndStyle();
} else {
NotificationHelper.alert(getContext(),
getContext().getString(R.string.dialog_error_title),
e.getMessage());
}
}
});
}
示例15: addUserToRoom
import com.parse.SaveCallback; //導入依賴的package包/類
private void addUserToRoom() {
mRoom.getUsers().add(mCurrentUser);
mRoom.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
setRegisteredVisibilityAndStyle();
} else {
setNotRegisteredVisibilityAndStyle();
NotificationHelper.alert(getContext(),
getContext().getString(R.string.dialog_error_title),
e.getMessage());
}
}
});
}