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


Java ParseQuery.whereNotEqualTo方法代碼示例

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


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

示例1: getAllUsers

import com.parse.ParseQuery; //導入方法依賴的package包/類
@NonNull
@Override
public Observable<List<ExampleUser>> getAllUsers(UserQueries.GetAllUsersQuery query) {
    final ParseQuery<ParseUser> parseQuery = new ParseQuery<>("_User");
    parseQuery.whereNotEqualTo("objectId", mParseHelper.getCurrentUser().getObjectId());
    parseQuery.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY);

    return mParseHelper.find(parseQuery)
        .flatMap(Observable::from)
        .map(ParseUtils::fromParseUser)
        .toList()
        .subscribeOn(Schedulers.io());
}
 
開發者ID:badoo,項目名稱:Chateau,代碼行數:14,代碼來源:ParseUserDataSource.java

示例2: Build

import com.parse.ParseQuery; //導入方法依賴的package包/類
public static ParseQuery Build(String className, HashMap[] conditions) {

    ParseQuery<ParseObject> query = new ParseQuery(className);

    // Create a composite query via chaining
    for (int i = 0; i < conditions.length; ++i) {
      HashMap map = conditions[i];

      // These fields must be named exactly the same in the calling application
      String key = (String)map.get("key");
      String condition = (String)map.get("condition");
      Object value = map.get("value");

      if (HasValidConditions(map)) {

        // This sucks, but I don't really want to try to be clever and use
        // reflection to map conditions to method names. It's not by any means
        // a complete implementation, as it only contains condition matching
        // for basic operations.
        if (condition.equals("==")) {
          query = query.whereEqualTo(key, value);
        }
        else if (condition.equals("!=")) {
          query = query.whereNotEqualTo(key, value);
        }
        else if (condition.equals(">")) {
          query = query.whereGreaterThan(key, value);
        }
        else if (condition.equals("<")) {
          query = query.whereLessThan(key, value);
        }
        else if (condition.equals(">=")) {
          query = query.whereGreaterThanOrEqualTo(key, value);
        }
        else if (condition.equals("<=")) {
          query = query.whereLessThanOrEqualTo(key, value);
        }
        else if (condition.equals("exists")) {
          query = query.whereExists(key);
        }
        else if (condition.equals("notexists")) {
          query = query.whereDoesNotExist(key);
        }
        else if (condition.equals("orderby")) {
          if (value.equals("asc")) {
            query = query.orderByAscending(key);
          }
          else if (value.equals("desc")) {
            query = query.orderByDescending(key);
          }
          else {
            Log.e(TAG, "Unrecognized sorting order, use 'asc' or 'desc'.");
          }
        }
        else {
          Log.e(TAG, "The condition '"+ condition + "' was not recognized by " +
          "the module. Create a request for implementation on GitHub, or " +
          "implemented it and create a pull request.");
        }
      }
    }

    return query;
  }
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:65,代碼來源:QueryFactory.java

示例3: populateListView

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void populateListView(){
    templist = new ArrayList<ParseObject>();
    listingObjects = new ArrayList<ListingObject>();
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Listing");
    query.whereNotEqualTo("title", " ");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, ParseException e) {
            if (e == null) {
                Log.d("score", "Retrieved " + parseObjects.size() + " scores");
                templist = parseObjects;
                for(int x = 0; x < parseObjects.size(); x++){
                    ListingObject l = new ListingObject(parseObjects.get(x).getString("title"),parseObjects.get(x).getString("address"),parseObjects.get(x).getString("description"),parseObjects.get(x).getString("creator"),parseObjects.get(x).getString("creatorName"));
                    try {
                        l.setListingType(parseObjects.get(x).getString("serviceType"));
                    }catch(NullPointerException n){

                    }
                    listingObjects.add(l);
                    Log.i("ObjectCreated",new ListingObject(parseObjects.get(x).getString("title"),parseObjects.get(x).getString("address"),parseObjects.get(x).getString("description"),parseObjects.get(x).getString("creator"),parseObjects.get(x).getString("creatorName")).toString());
                    listingAdapter = new ListingAdapter(getApplicationContext(),listingObjects);
                    listview = (ListView)findViewById(R.id.lists);
                    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                            ListingObject myobj = listingAdapter.getItem(position);
                            String name = myobj.getTitle();
                            String ad = myobj.getAddress();
                            String des = myobj.getDescription();
                            Intent myIntent = new Intent(getApplicationContext(),ListingActivity.class);
                            myIntent.putExtra("title",name);
                            myIntent.putExtra("address",ad);
                            myIntent.putExtra("description",des);
                            myIntent.putExtra("creator",myobj.getCreator());
                            myIntent.putExtra("creatorName",myobj.getCreatorName());
                            Log.d("CreatorName",myobj.getCreatorName());
                            startActivity(myIntent);
                        }
                    });
                    listview.setAdapter(listingAdapter);
                }
            } else {
                Log.d("score", "Error: " + e.getMessage());
            }

        }
    });
    Log.i("Listview",listingObjects.toString());

}
 
開發者ID:hackathoner,項目名稱:Barter,代碼行數:51,代碼來源:HomePage.java

示例4: recommendPeople

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void recommendPeople(){

        if(currentUser.get("City").toString() != "Blank") {
            users = new ArrayList<>();
            ParseQuery<ParseUser> query = ParseUser.getQuery();
            query.whereNotEqualTo("username", currentUser.getUsername().toString());
            query.findInBackground(new FindCallback<ParseUser>() {
                public void done(List<ParseUser> objects, ParseException e) {
                    if (e == null) {
                        Log.e("Discovery", objects.toString());
                        calculateWeight((ArrayList<ParseUser>) objects);
                        ArrayList<ParseUser> parseUserDB = weightedUsers;
                        //pass the data into discovery user array list
                        for (int i = 0; i < parseUserDB.size(); i++) {
                            ParseUser tmpUser = parseUserDB.get(i);
                            String username = tmpUser.getUsername();
                            String gender = tmpUser.get("Gender").toString();
                            String location = tmpUser.get("City").toString();
                            ParseFile imageFile = (ParseFile) tmpUser.get("Image");
                            Bitmap profileImage;
                            if (imageFile != null) {
                                byte[] bitmapdata = new byte[0];
                                try {
                                    bitmapdata = imageFile.getData();
                                } catch (ParseException eg) {
                                    eg.printStackTrace();
                                }
                                Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, bitmapdata.length);
                                profileImage = bitmap;
                            } else {
                                Drawable myDrawable = getResources().getDrawable(R.drawable.default_profile_image);
                                Bitmap defaultImage = ((BitmapDrawable) myDrawable).getBitmap();
                                profileImage = defaultImage;
                            }
                            DiscoverUser discoverUser = new DiscoverUser();
                            discoverUser.setProfileImage(profileImage);
                            discoverUser.setUsername(username);
                            discoverUser.setGender(gender);
                            discoverUser.setLocation(location);
                            if(!currentUser.getUsername().equals(discoverUser.getUsername())) {
                                users.add(discoverUser);
                            }
                        }
                        discoveryAdapter.setUsers(users);
                        discoveryAdapter.notifyDataSetChanged();
                    } else {
                        // Something went wrong.
                        Log.e("Discovery", "Exception thrown");
                    }
                }
            });
        }
    }
 
開發者ID:CarlXue,項目名稱:COMP90018,代碼行數:54,代碼來源:DiscoveryFragment.java

示例5: onCreate

import com.parse.ParseQuery; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_list);

    usernames = new ArrayList<String>();
    listView = (ListView) findViewById(R.id.listView);

    arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, usernames);
    listView.setAdapter(arrayAdapter);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(i, position);

        }
    });

    ParseQuery<ParseUser> query = ParseUser.getQuery();

    Log.i("asdf", ParseUser.getCurrentUser().getUsername());

    query.whereNotEqualTo("username", ParseUser.getCurrentUser().getUsername());
    query.findInBackground(new FindCallback<ParseUser>() {
        public void done(List<ParseUser> objects, ParseException e) {
            if (e == null) {

                if (objects.size() > 0) {

                    usernames.clear();

                    for (ParseUser user : objects) {

                        usernames.add(user.getUsername());

                    }

                    arrayAdapter.notifyDataSetChanged();

                }


            } else {
                // Something went wrong.
            }
        }
    });

    checkForImages();


}
 
開發者ID:angeshpokharel,項目名稱:Snapchat-parse,代碼行數:56,代碼來源:UserList.java


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