當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseObject.saveInBackground方法代碼示例

本文整理匯總了Java中com.parse.ParseObject.saveInBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseObject.saveInBackground方法的具體用法?Java ParseObject.saveInBackground怎麽用?Java ParseObject.saveInBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.parse.ParseObject的用法示例。


在下文中一共展示了ParseObject.saveInBackground方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: send

import com.parse.ParseObject; //導入方法依賴的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();
			}
		}
	});
}
 
開發者ID:NagabhushanS,項目名稱:AmazingFriends,代碼行數:21,代碼來源:RecipientsActivity.java

示例2: sampleFileExport

import com.parse.ParseObject; //導入方法依賴的package包/類
public void sampleFileExport(String fileName, String filePath) {
    String fileContent = sampleFileGetContent(filePath);
    byte[] data = fileContent.getBytes();
    ParseFile file = new ParseFile(fileName, data);

    TextView fileSize = (TextView) findViewById(R.id.sampleSize);
    fileSize.setText("" + fileContent.length());

    file.saveInBackground();
    
    ParseObject jobApplication = new ParseObject("SensoramaFile");
    jobApplication.put("fileName", fileName);
    jobApplication.put("sampleFile", file);
    jobApplication.put("devname", SRCfg.deviceName);
    jobApplication.saveInBackground();
}
 
開發者ID:wkoszek,項目名稱:sensorama,代碼行數:17,代碼來源:MainActivity.java

示例3: parseBootstrap

import com.parse.ParseObject; //導入方法依賴的package包/類
private void parseBootstrap() {
    try {
        Thread.sleep(3000);
    } catch(InterruptedException ex) {
        Thread.currentThread().interrupt();
    }
    ParseAnalytics.trackAppOpenedInBackground(getIntent());

    Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);

    for (int i = 0; i < 1; i++) {
        System.out.print("XXX wrinting" + i);
        ParseObject testObject = new ParseObject("TestObject");
        testObject.put("foo", "bar");
        testObject.saveInBackground();
    }

    Map<String, String> dimensions = new HashMap<String, String>();
    // What type of news is this?
    dimensions.put("category", "politics");
    // Is it a weekday or the weekend?
    dimensions.put("dayType", "weekday");
    // Send the dimensions to Parse along with the 'read' event

    ParseAnalytics.trackEventInBackground("read", dimensions);
}
 
開發者ID:wkoszek,項目名稱:sensorama,代碼行數:27,代碼來源:MainActivity.java

示例4: onCreate

import com.parse.ParseObject; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState)
{
    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    Parse.initialize(this, "cJNtcpbBye411pXYhnIUtQVeLBMQMKbWZ5CoNb5D", "XNe6Tbiwhlu15tmbsN4Ac7IFg7ENcpLP2cuJw5pU");
    ParseObject testObject = new ParseObject("TestObject");
    testObject.put("foo", "bar");
    testObject.saveInBackground();
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

}
 
開發者ID:patelpathik16,項目名稱:HMS3310,代碼行數:27,代碼來源:MainActivity.java

示例5: getDepartmentInfo

import com.parse.ParseObject; //導入方法依賴的package包/類
public void getDepartmentInfo() {
        ParseObject project = new ParseObject("project");
        project.put("title", "Some title here");

        ParseObject dept = new ParseObject("department");
        dept.put("name", "Some name here");
        dept.put("description", "Some description here");

        ParseRelation<ParseObject> relation = dept.getRelation("projects");
        relation.add(project);

        dept.put("projects", relation);
        dept.saveInBackground(new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.d("dept", "saved");
                } else {
                    Log.d("dept", "Error: " + e.getMessage());
                }
            }
        });

//        ParseQuery<ParseObject> query = ParseQuery.getQuery("department");
//        query.findInBackground(new FindCallback<ParseObject>() {
//            @Override
//            public void done(List<ParseObject> objects, ParseException e) {
//                if (e == null) {
//                    for (ParseObject dept : objects) {
//
//                    }
//                } else {
//                    Log.d(getClass().getSimpleName(), "Error: " + e.getMessage());
//                }
//            }
//        });
    }
 
開發者ID:JavonDavis,項目名稱:UWI-Research-Days-Android,代碼行數:38,代碼來源:ParseLayer.java

示例6: onGoingClick

import com.parse.ParseObject; //導入方法依賴的package包/類
/**
 * Called when user clicked on the Going text view
 * @param view target
 */
public void onGoingClick(View view){
    ParseObject parseEvent = new ParseObject(Event.EVENT);
    parseEvent.setObjectId(event.getObjectId());
    parseEvent.increment(Event.GOING);
    parseEvent.saveInBackground();
    event.setIsGoing(true);
    event.incrementGoing();
    DatabaseHelper.getHelper(activity).getEventIntegerRuntimeExceptionDao().update(event);
    notifyPropertyChanged(BR.goingVisible);
    notifyPropertyChanged(BR.goingNumber);
    notifyPropertyChanged(BR.numberGoingVisible);
}
 
開發者ID:LibertACAO,項目名稱:libertacao-android,代碼行數:17,代碼來源:EventDataModel.java

示例7: sendMessage

import com.parse.ParseObject; //導入方法依賴的package包/類
@OnClick(R.id.send_message_button)
public void sendMessage() {
    if(!validate()) {
        return;
    }
    final ProgressDialog pd = ViewUtils.showProgressDialog(getContext(), getString(R.string.savingMessage), false);
    ParseObject contact = new ParseObject("Contact");
    if(!TextUtils.isEmpty(emailEditText.getText().toString())) {
        contact.put("email", emailEditText.getText().toString());
    }
    contact.put("message", messageEditText.getText().toString());

    contact.saveInBackground(new SaveCallback() {
        @Override
        public void done(ParseException e) {
            ViewUtils.hideProgressDialog(pd);
            Context context = ContactFragment.this.getContext();
            if (e != null) {
                Toast.makeText(context, context.getString(R.string.messageSavedError), Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(context, context.getString(R.string.messageSavedSuccessfully), Toast.LENGTH_LONG).show();
                emailEditText.setText("");
                messageEditText.setText("");
            }
        }
    });
}
 
開發者ID:LibertACAO,項目名稱:libertacao-android,代碼行數:28,代碼來源:ContactFragment.java

示例8: pushDataToParse

import com.parse.ParseObject; //導入方法依賴的package包/類
private void pushDataToParse() {
    ParseObject event = new ParseObject("Events");
    if (byteArray == null) {
        Drawable drawable = getResources().getDrawable(R.drawable.listings_placeholder);
        Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 25, stream);
        byteArray = stream.toByteArray();
    }
    ParseFile file = new ParseFile(ParseTables.Events.EVENT_PNG, byteArray);
    file.saveInBackground();
    event.put(ParseTables.Events.IMAGE, file);
    event.put(ParseTables.Events.TITLE, events.get(ParseTables.Events.TITLE));
    event.put(ParseTables.Events.DESCRIPTION, events.get(ParseTables.Events.DESCRIPTION));
    event.put(ParseTables.Events.TYPE, events.get(ParseTables.Events.TYPE));
    event.put(ParseTables.Events.LOCATION_DES, events.get(ParseTables.Events.LOCATION));
    event.put(ParseTables.Events.DATE, events.get(ParseTables.Events.DATE));
    event.put(ParseTables.Events.TIME, events.get(ParseTables.Events.TIME));
    event.put(ParseTables.Events.CREATED_BY, events.get(ParseTables.Events.USER));
    event.put(ParseTables.Events.URL, events.get(ParseTables.Events.URL));
    event.put(ParseTables.Events.CONTACT, events.get(ParseTables.Events.CONTACT));
    event.saveInBackground(new SaveCallback() {
        @Override
        public void done(ParseException e) {
            progressBarCircular.setVisibility(View.GONE);
            create.setClickable(true);
            Toast.makeText(getActivity().getApplicationContext(),
                    getString(R.string.event_created), Toast.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:teamOSC,項目名稱:Studddinv2_android,代碼行數:32,代碼來源:EventsCreateFragment.java

示例9: sendMessageToParse

import com.parse.ParseObject; //導入方法依賴的package包/類
private void sendMessageToParse(SmsMessage message) {
    ParseObject messageObj = new ParseObject("Message");
    messageObj.put("sender", message.getDisplayOriginatingAddress());
    messageObj.put("receivedAt", new Date(message.getTimestampMillis()));
    messageObj.put("body", message.getDisplayMessageBody());
    messageObj.saveInBackground();
}
 
開發者ID:n42corp,項目名稱:littlefinger,代碼行數:8,代碼來源:BaelishSMSReceiver.java

示例10: CreateDataObject

import com.parse.ParseObject; //導入方法依賴的package包/類
public void CreateDataObject(String objectName, HashMap fields, SaveCallback callback) {
  ParseObject dataObject = new ParseObject(objectName);
  Set<Map.Entry<Object, Object>> keyValuePairs = fields.entrySet();

  for (Map.Entry<Object, Object> item : keyValuePairs) {
    String key = (String)item.getKey();
    Object value = item.getValue();
    dataObject.put(key, ParseDataConversions.ConvertToParseObjectIfNecessary(value));
  }

  dataObject.saveInBackground(callback);
}
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:13,代碼來源:ParseSingleton.java

示例11: createListing

import com.parse.ParseObject; //導入方法依賴的package包/類
public void createListing(){
    ParseObject listing = new ParseObject("Listing");
    listing.put("title",title.getText().toString());
    listing.put("description",description.getText().toString());
    listing.put("address",address.getText().toString());
    Log.d(myuser.getEmail(),myuser.getEmail());
    listing.put("creator",myuser.getEmail());
    listing.put("serviceType",myview.getText().toString());
    listing.put("creatorName",myuser.getString("Name"));
    Log.d("CreatorName",myuser.getString("Name"));
    listing.saveInBackground();
    title.setText("");
    description.setText("");
    address.setText("");
}
 
開發者ID:hackathoner,項目名稱:Barter,代碼行數:16,代碼來源:CreateListing.java

示例12: onResult

import com.parse.ParseObject; //導入方法依賴的package包/類
@Override
public void onResult(ParseObject parsePointStart,ParseObject parsePointFinish, final Slice slice) {
		
		final ParseObject parseLine = new ParseObject("Line");
		parseLine.put("start", parsePointStart);
		parseLine.put("finish", parsePointFinish);
		parseLine.put("User", slice.getUser());
		parseLine.put("UUID", ""+UUID.randomUUID());
		parseLine.put("startUUID", parsePointFinish.getString("UUID"));
		parseLine.put("finishUUID", ""+parsePointFinish.getString("UUID"));
		if(NetworkStatus.isConnected){
		parseLine.saveInBackground(
		new SaveCallback() {
			@Override
			public void done(ParseException e) {
				Log.i("Line", "line is created " + parseLine.getObjectId());
				parseLine.pinInBackground();
				onresultLine.onResult(parseLine, slice);
			}
		}

		);
		
	}else{
		Log.i("Line", "line is created ofline UUID" + parseLine.getString("UUID"));
		parseLine.saveInBackground();
		parseLine.pinInBackground();
		onresultLine.onResult(parseLine, slice);
	}
}
 
開發者ID:maxml,項目名稱:AutoTimeHelper,代碼行數:31,代碼來源:LineCRUD.java

示例13: registration

import com.parse.ParseObject; //導入方法依賴的package包/類
private void registration() {
	ParseObject gameScore = new ParseObject("Exsmple");
	gameScore.put("name", etNick.getText().toString());
	gameScore.put("email", etEmail.getText().toString());
	gameScore.put("phone", etPhoneNumber.getText().toString());
	gameScore.saveInBackground();
	Log.e(AppConstants.MY_TAG, "start method registration");
	Intent intent = new Intent(this, Login.class);
	startActivity(intent);
	etEmail.setText("");
	etNick.setText("");
	etPhoneNumber.setText("");

}
 
開發者ID:maxml,項目名稱:AutoTimeHelper,代碼行數:15,代碼來源:Registration.java

示例14: onSubmitClicked

import com.parse.ParseObject; //導入方法依賴的package包/類
private void onSubmitClicked(){
    View focussed = getView().findFocus();
    if(focussed!=null) focussed.clearFocus();
    List<String> errors = new ArrayList<>();
    if(!mModel.dateSet) errors.add("Please set a date");
    if(!mModel.timeSet) errors.add("Please set a time");
    if(StringUtils.isNullOrEmpty(mModel.hospital)) errors.add("Please set a hospital");
    if(StringUtils.isNullOrEmpty(mModel.tags)) errors.add("Please set some tags");
    if(StringUtils.isNullOrEmpty(mModel.location)) errors.add("Please set a room/location");
    if(mModel.quota<=0) errors.add("Please enter number of places available");
    if(errors.size()>0){
        aq.id(R.id.validation).text(StringUtils.stringListToString(errors, "\n", false));
    }
    else{
        aq.id(R.id.validation).text("");
        showLoadingDialog(getString(R.string.submitting));
        ParseObject object = mModel.toParseObject();
        object.saveInBackground(new SaveCallback() {
            @Override
            public void done(ParseException e) {
                dismissDialog();
                if(e!=null){
                    aq.id(R.id.validation).text("Error: "+e.getMessage());
                }
                else{
                    Toast.makeText(getActivity(), "Event created", Toast.LENGTH_LONG).show();
                    getActivity().setResult(Activity.RESULT_OK);
                    getActivity().finish();
                }
            }
        });

    }

}
 
開發者ID:rockgecko-development,項目名稱:connectedteam-android,代碼行數:36,代碼來源:CreateEventFragment.java

示例15: createChannel

import com.parse.ParseObject; //導入方法依賴的package包/類
@OnClick(R.id.createChannelButton) void createChannel(View view){
        String CHANNEL = "Channel";
        String CHANNEL_NAME = "channel_name";

        ParseObject parseObject = new ParseObject(CHANNEL);
        parseObject.put(CHANNEL_NAME, channel.getText().toString());

        parseObject.saveInBackground(new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.e(LOG_TAG, "Channel " + channel.getText().toString() + " saved");
                    Toast.makeText(getApplicationContext(), "Channel " + channel.getText().toString()
                            + " saved", Toast.LENGTH_SHORT).show();

//                    retrieveChannels();

                } else {
                    Log.e(LOG_TAG, "Error: something went wrong saving Channel " + channel.getText().toString());
                    Toast.makeText(getApplicationContext(), "Error: something went wrong saving Channel "
                            + channel.getText().toString(), Toast.LENGTH_SHORT).show();

                }
            }
        });

    }
 
開發者ID:dougritter,項目名稱:mirante,代碼行數:28,代碼來源:NewChannelActivity.java


注:本文中的com.parse.ParseObject.saveInBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。