本文整理汇总了Java中com.parse.ParseQuery.whereContains方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.whereContains方法的具体用法?Java ParseQuery.whereContains怎么用?Java ParseQuery.whereContains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.whereContains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RoomQueryAdapter
import com.parse.ParseQuery; //导入方法依赖的package包/类
public RoomQueryAdapter(final Context context, final String searchQuery) {
super(context, new QueryFactory<Room>() {
@Override
public ParseQuery<Room> create() {
ParseQuery<Room> query = new ParseQuery<>(Constants.ROOM_TABLE);
if (searchQuery != null) {
query.whereContains(Constants.ROOM_COL_NAME, searchQuery);
}
query.whereNotEqualTo(Constants.ROOM_COL_CREATED_BY,
LocalDb.getInstance().getCurrentUser())
.orderByDescending(Constants.PARSE_COL_CREATED_AT)
.setLimit(LIMIT);
return query;
}
});
}
示例2: visitHistoryDialog
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void visitHistoryDialog(){
AlertDialog.Builder visitHistoryBuilder = new AlertDialog.Builder(KidDetail.this);
visitHistoryBuilder.setCancelable(true);
LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
View view = inflater.inflate(R.layout.visit_history,null);
visitHistoryBuilder.setView(view);
final TextView historyText = (TextView) view.findViewById(R.id.historyText);
final StringBuilder historyString = new StringBuilder();
ParseQuery<Visit> query = ParseQuery.getQuery(Visit.class);//.fromLocalDatastore();
query.whereContains("kidId",myKid.getObjectId());
query.orderByAscending("createdAt");
query.findInBackground(new FindCallback<Visit>() {
@Override
public void done(@NonNull List<Visit> list, @Nullable ParseException e) {
if (e == null){
if(list.size()!=0){
for (int i = 0; i < list.size() ; i++) {
Visit visit = list.get(i);
historyString.append("Visit No. : "+ (i+1)+"\n");
historyString.append("Visit Date: "+visit.getVisitDate()+"\n");
historyString.append("Servants:\n "+visit.getServants()+"\n");
historyString.append("Visit summary:\n "+visit.getSummary()+"\n\n\n");
}
historyText.setText(historyString);
}else{
historyText.setText("No visit history found!\nPlease pay a visit asap.");
}
}else{Toast.makeText(getApplicationContext(),"Error!",Toast.LENGTH_LONG).show();}
}
});
AlertDialog historyDialog = visitHistoryBuilder.create();
historyDialog.show();
}
示例3: LoadMoreItems
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void LoadMoreItems(int limit) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Product");
query.whereContains("title", this.query);
query.setLimit(limit).orderByAscending("createdAt");
dialog = new ProgressDialog(this);
dialog.setTitle("Loading");
dialog.setMessage("Please Wait...");
dialog.show();
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
dialog.dismiss();
if (e == null) {
data.clear();
for (int a = 0; a < list.size(); a++) {
ParseObject object = list.get(a);
ItemsModel model = new ItemsModel();
model.setDate(String.valueOf(object.getCreatedAt().toLocaleString()));
model.setPrice(object.getNumber("price").toString());
model.setPhone(object.getNumber("phone").toString());
model.setDesc(object.getString("desc"));
model.setTitle(object.getString("title"));
model.setImagefile(object.getParseFile("image").getUrl());
data.add(model);
}
adapter.UpdateData(data);
}else {
Toast.makeText(SearchableActivity.this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
示例4: LoadData
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void LoadData() {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Product");
query.setLimit(5).orderByAscending("createdAt");
query.whereContains("title", this.query);
dialog = new ProgressDialog(this);
dialog.setTitle("Loading");
dialog.setMessage("Please Wait...");
dialog.show();
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
dialog.dismiss();
if (e == null) {
data.clear();
for (int a = 0; a < list.size(); a++) {
ParseObject object = list.get(a);
ItemsModel model = new ItemsModel();
model.setDate(String.valueOf(object.getCreatedAt().toLocaleString()));
model.setPrice(object.getNumber("price").toString());
model.setPhone(object.getNumber("phone").toString());
model.setDesc(object.getString("desc"));
model.setTitle(object.getString("title"));
model.setImagefile(object.getParseFile("image").getUrl());
data.add(model);
}
adapter = new RecyclerViewAdapter(data, SearchableActivity.this);
adapter.setClickListener(SearchableActivity.this);
recyclerView.setAdapter(adapter);
}else {
Toast.makeText(SearchableActivity.this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
示例5: performSearch
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void performSearch(final String s) {
if(s.equals("")) {
Toast.makeText(getActivity(),"Please Enter Something",Toast.LENGTH_SHORT).show();
return;
}
ParseQuery<ParseObject> query = new ParseQuery<>(
"Notes");
clear_lists();
query.whereContains("topicName",s);
query.orderByDescending("createdAt");
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> parseObjects, ParseException e) {
// Log.d("Search notes","result size : "+String.valueOf( parseObjects.size())+" "+s);
for (ParseObject notes : parseObjects) {
notesBranchName.add((String) notes.get("branchName"));
notesSubjectName.add((String) notes.get("subjectName"));
notesCollegeName.add((String) notes.get("collegeName"));
notesTopicName.add((String) notes.get("topicName"));
uploadedBy.add((String) notes.get("userName"));
notesFirstImage.add((ArrayList<ParseFile>) notes.get("notesImages"));
}
notesCustomGridViewAdapter = new NotesCustomGridViewAdapter(getActivity(), notesCollegeName,
notesBranchName, notesTopicName, notesSubjectName, notesFirstImage, uploadedBy);
mRecyclerView.setAdapter(notesCustomGridViewAdapter);
// notesCustomGridViewAdapter.notifyDataSetChanged();
}
});
}
示例6: doAsyncTask
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected List<Feriado> doAsyncTask(String... params) {
state = params[0];
city = params[1];
try {
List<Feriado> list = new ArrayList<>();
if(state !=null && !state.equals("")&& city!=null && !city.equals("")) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("State");
query.whereEqualTo("name", state);
ParseObject parseObject = query.getFirst();
ParseQuery<ParseObject> queryCity = ParseQuery.getQuery("City");
queryCity.whereEqualTo("id_state", parseObject.getInt("id_state"));
queryCity.whereContains("name_city", city);
ParseObject parseCity = queryCity.getFirst();
ParseQuery<ParseObject> queryHoliday = ParseQuery.getQuery("Holiday");
queryHoliday.whereEqualTo("id_state", parseObject.getInt("id_state"));
queryHoliday.whereEqualTo("id_city", parseCity.getInt("id_city"));
List<ParseObject> parseObjects = queryHoliday.find();
ParseQuery<ParseObject> queryStateHoliday = ParseQuery.getQuery("StateHoliday");
queryStateHoliday.whereEqualTo("id_state", parseObject.getInt("id_state"));
parseObjects.addAll(queryStateHoliday.find());
for (ParseObject p : parseObjects) {
Feriado feriado = new Feriado();
feriado.setData(p.getString("date"));
feriado.setNome(p.getString("name"));
list.add(feriado);
}
}
return list;
} catch (Exception e) {
return null;
}
}
示例7: doInBackground
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected String doInBackground(String... params)
{
userQuery = params[0];
booksResults.clear();
/*
* Get the parse objects based on the query entered.
*/
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Posted");
query.whereContains("useremail", userQuery);
try
{
Log.w("Parse", "Inside getbooks()");
List<ParseObject> queryResult = query.find();
for (ParseObject book : queryResult)
{
HashMap<String, String> test = new HashMap<>();
String dept = book.getString("dept");
String title = book.getString("Title");
String author = book.getString("Author");
String price = book.getString("Price");
String place = book.getString("Place");
String desp = book.getString("Description");
String phone = book.getString("phone");
String oprice = book.getString("oprice");
String objId = book.getObjectId();
String status = book.getString("status");
test.put("dept", dept);
test.put("title", title);
test.put("author", author);
test.put("price", price);
test.put("place", place);
test.put("description", desp);
test.put("phone", phone);
test.put("oprice", oprice);
test.put("objectId",objId);
test.put("status",status);
booksResults.add(test);
}
}
catch (ParseException e)
{
Log.d("Books", "Error: " + e.getMessage());
}
return userQuery;
}
示例8: doInBackground
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected String doInBackground(String... params)
{
userQuery = params[0];
booksResults.clear();
/*
* Get the parse objects based on the query entered.
*/
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Posted");
if (flag == 0)
{
String lowTitle = userQuery.toLowerCase();
query.whereContains("title", lowTitle);
}
else
if (flag == 1)
{
String lowAuthor = userQuery.toLowerCase();
query.whereContains("author", lowAuthor);
}
else
query.whereContains("dept", userQuery);
try
{
Log.w("Parse", "Inside getbooks()");
List<ParseObject> queryResult = query.find();
for (ParseObject book : queryResult)
{
HashMap<String, String> test = new HashMap<>();
String dept = book.getString("dept");
String title = book.getString("Title");
String author = book.getString("Author");
String price = book.getString("Price");
String place = book.getString("Place");
String desp = book.getString("Description");
String phone = book.getString("phone");
String oprice = book.getString("oprice");
String userName = book.getString("username");
String userEmail = book.getString("useremail");
String status = book.getString("status");
test.put("dept", dept);
test.put("title", title);
test.put("author", author);
test.put("price", price);
test.put("place", place);
test.put("description", desp);
test.put("phone", phone);
test.put("oprice", oprice);
test.put("username",userName);
test.put("useremail",userEmail);
test.put("status",status);
booksResults.add(test);
}
}
catch (ParseException e)
{
Log.d("Books", "Error: " + e.getMessage());
}
return userQuery;
}