本文整理汇总了Java中com.parse.ParseObject类的典型用法代码示例。如果您正苦于以下问题:Java ParseObject类的具体用法?Java ParseObject怎么用?Java ParseObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseObject类属于com.parse包,在下文中一共展示了ParseObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: onCreate
import com.parse.ParseObject; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
ParseObject.registerSubclass(Kid.class);
ParseObject.registerSubclass(Visit.class);
ParseObject.registerSubclass(Attendance.class);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("PARSE applicationId to be added here")
.clientKey("Parse Client Id to be added here")
.server("Parse server address to be added here").enableLocalDataStore().build());
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
示例3: getContactInfos
import com.parse.ParseObject; //导入依赖的package包/类
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
pQuery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> arg0, ParseException arg1) {
if (arg0 != null) {
List<EaseUser> mList = new ArrayList<EaseUser>();
for (ParseObject pObject : arg0) {
EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
if (parseFile != null) {
user.setAvatar(parseFile.getUrl());
}
user.setNick(pObject.getString(CONFIG_NICK));
EaseCommonUtils.setUserInitialLetter(user);
mList.add(user);
}
callback.onSuccess(mList);
} else {
callback.onError(arg1.getCode(), arg1.getMessage());
}
}
});
}
示例4: retreiveprofile
import com.parse.ParseObject; //导入依赖的package包/类
public static void retreiveprofile(String username , final Context context) {
ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
query.whereEqualTo("user",username);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if(parseObject!=null && e==null) {
ParseFile file = (ParseFile) parseObject.get("image");
String url = "http://wwww.webianks.com";
if (file != null) {
url = file.getUrl().toString();
}
MainActivity.retriveProfileCallback(context, url);
}else{
//canntretrivee file
}
}
});
}
示例5: retreivetimelineprofile
import com.parse.ParseObject; //导入依赖的package包/类
public static void retreivetimelineprofile(String username , final Context context) {
ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
query.whereEqualTo("user",username);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if(parseObject!=null && e==null) {
ParseFile file = (ParseFile) parseObject.get("image");
String url = "http://wwww.webianks.com";
if (file != null) {
url = file.getUrl().toString();
}
Profile.retriveTimelineProfileCallback(context, url);
}else{
//canntretrivee file
}
}
});
}
示例6: onStudentFound
import com.parse.ParseObject; //导入依赖的package包/类
@Override
public void onStudentFound(String courseName, ParseObject object, int lab_count) {
GradeFragment gradeFragment = GradeFragment.newInstance(courseName, lab_count);
gradeFragment.setmObject(object);
/*
//added a little transition
//TODO - add more transition animations
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(1000);
Slide slideTransitionExit = new Slide(Gravity.LEFT);
slideTransition.setDuration(1000);
idNumberFragment.setExitTransition(slideTransitionExit);
gradeFragment.setEnterTransition(slideTransition);
gradeFragment.setAllowEnterTransitionOverlap(overlap);
idNumberFragment.setAllowReturnTransitionOverlap(overlap);
}*/
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, gradeFragment)
.addToBackStack("Grades")
.commit();
}
示例7: categorySpinnerSetup
import com.parse.ParseObject; //导入依赖的package包/类
public void categorySpinnerSetup() {
ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery create() {
ParseQuery query = new ParseQuery("Category");
return query;
}
};
categoryAdapter = new ParseQueryAdapter<ParseObject>(this,
factory);
categoryAdapter.setTextKey("name");
categorySpinner.setAdapter(categoryAdapter);
categorySpinner.setSelection(1);
categorySpinner
.setOnItemSelectedListener(new CategorySpinnerListener());
}
示例8: loadParseData
import com.parse.ParseObject; //导入依赖的package包/类
private void loadParseData(String Id){
ParseQuery<ParseObject> query = ParseQuery.getQuery(EventTable);
query.whereEqualTo("PhotoAlbumId", Id);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> productParseList, com.parse.ParseException e) {
if (e == null) {
if(productParseList.size() > 0){
eventList.addAll(productParseList);
eventAdapter = new PhotosAdapter(mContext, eventList);
gridView.setAdapter(eventAdapter);
}else{
Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show();
}
} else {
e.printStackTrace();
LoggerFactory.e("loadParseData", "Error: " + e.getMessage());
}
}
});
}
示例9: loadParseData
import com.parse.ParseObject; //导入依赖的package包/类
private void loadParseData(){
ParseQuery<ParseObject> query = ParseQuery.getQuery(tableName);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> productParseList, com.parse.ParseException e) {
if (e == null) {
if(productParseList.size() > 0){
eventList.addAll(productParseList);
eventAdapter = new VideoAdapter(mContext, eventList);
gridView.setAdapter(eventAdapter);
}else{
Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show();
}
} else {
e.printStackTrace();
LoggerFactory.e("loadParseData", "Error: " + e.getMessage());
}
}
});
}
示例10: onCreate
import com.parse.ParseObject; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
ParseObject.registerSubclass(Organization.class);
ParseObject.registerSubclass(UserBeacon.class);
ParseObject.registerSubclass(CustomUser.class);
ParseObject.registerSubclass(Note.class);
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId(Parse_appID)
.clientKey(null)
.addNetworkInterceptor(new ParseLogInterceptor())
.enableLocalDataStore() //enable local datastore within initialization since hosted elsewhere
.server("http://estinote.herokuapp.com/parse/") // The trailing slash is important.
.build()
);
//scan();
}
示例11: init
import com.parse.ParseObject; //导入依赖的package包/类
public void init() {
MainApplication.ServerHost = getSharedPreferences("ip",MODE_PRIVATE).getString("ip",null);
if(MainApplication.ServerHost==null)
MainApplication.ServerHost = Constants.ServerHost;
Fresco.initialize(getApplicationContext());
ParseObject.registerSubclass(UserInfo.class);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("langrensha")
.clientKey("")
.server(Constants.makeNewIpAddress(MainApplication.ServerHost) + "/parse")
.enableLocalDataStore()
.build()
);
initSocket();
SoundEffectManager.init(this);
}
示例12: send
import com.parse.ParseObject; //导入依赖的package包/类
@NonNull
@Override
public Observable<Void> send(@NonNull SendQuery<ExampleMessage> query) {
final ExampleMessage message = query.getMessage();
final String conversationId = query.getConversationId();
final ParseObject parseMessage = createOutgoingParseObject(conversationId, message);
// Give it a timestamp that ensured that it ends up last (this will be replaced by the real server side timestamp)
mLastMessageTimestamp = Math.max(System.currentTimeMillis(), mLastMessageTimestamp + 1);
final ExampleMessage unconfirmedMessage = ExampleMessage.createUnconfirmedMessage(message.getLocalId(), mParseHelper.getCurrentUser().getObjectId(), message.getPayload(), mLastMessageTimestamp);
mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.ADDED, null, unconfirmedMessage));
return saveMessage(parseMessage)
.observeOn(Schedulers.io())
.doOnError(throwable -> onFailedToSend(conversationId, unconfirmedMessage))
.doOnSuccess(parseObject -> onMessageSent(conversationId, parseObject, unconfirmedMessage))
.toObservable()
.ignoreElements()
.cast(Void.class);
}
示例13: createOutgoingParseObject
import com.parse.ParseObject; //导入依赖的package包/类
private ParseObject createOutgoingParseObject(String conversationId, ExampleMessage message) {
final ParseObject parseMessage = ParseObject.create(MessagesTable.NAME);
parseMessage.put(MessagesTable.Fields.FROM, mParseHelper.getCurrentUser());
if (message.getPayload() instanceof TextPayload) {
parseMessage.put(MessagesTable.Fields.TYPE, MessagesTable.Types.TEXT);
parseMessage.put(MessagesTable.Fields.MESSAGE, ((TextPayload) message.getPayload()).getMessage());
}
else if (message.getPayload() instanceof ImagePayload) {
parseMessage.put(MessagesTable.Fields.TYPE, MessagesTable.Types.IMAGE);
}
parseMessage.put(MessagesTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, conversationId));
// Need to ensure the message sent back has the generated local id so it can be matched with responses form the server
parseMessage.put(MessagesTable.Fields.LOCAL_ID, message.getLocalId());
return parseMessage;
}
示例14: updateMessage
import com.parse.ParseObject; //导入依赖的package包/类
/**
* Request a single message in a conversation to be updated.
*/
private void updateMessage(@NonNull String conversationId, @NonNull String messageId) {
ParseQuery<ParseObject> query = new ParseQuery<>(MessagesTable.NAME);
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY);
query.include(MessagesTable.Fields.IMAGE);
Log.d(TAG, "Updating message: " + messageId);
mParseHelper.get(query, messageId)
.map(in -> ParseUtils.from(in, mParseHelper))
.toList()
.subscribe(messages -> {
for (ExampleMessage message : messages) {
mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.UPDATED, null, message));
}
});
}
示例15: delete
import com.parse.ParseObject; //导入依赖的package包/类
@NonNull
@Override
public Observable<List<ExampleConversation>> delete(DeleteConversationsQuery<ExampleConversation> query) {
final Map<String, Object> params = new HashMap<>();
List<String> chatIds = new ArrayList<>();
for (ExampleConversation c : query.getConversations()) {
chatIds.add(c.getId());
}
params.put(DeleteConversationsFunc.Fields.CHAT_IDS, chatIds);
// The response contains all deleted conversations
return mParseHelper.<List<ParseObject>>callFunction(DeleteConversationsFunc.NAME, params)
.flatMap(Observable::from)
.map(in -> ParseUtils.conversationFromChat(in, mParseHelper))
.doOnNext(exampleConversation -> mConversationUpdatePublisher.onNext(true))
.toList()
.ignoreElements()
.concatWith(load(null).ignoreElements().map(i -> Collections.<ExampleConversation>emptyList()))
.subscribeOn(Schedulers.io());
}