コード例 #1
0
  public void getQuotes(final Context context) {
    row_quotes = new ArrayList<RowQuote>();

    query.whereExists("createdAt");
    query.orderByDescending("createdAt");
    query.setLimit(1000);

    query.findInBackground(
        new FindCallback<ParseObject>() {
          @Override
          public void done(List<ParseObject> quoteList, ParseException e) {
            if (e == null) {
              for (int i = 0; i < quoteList.size(); i++) {
                String quote = quoteList.get(i).getString("Quote");
                String name = quoteList.get(i).getString("Name");
                row_quotes.add(new RowQuote(name, quote));

                //						if (i == quoteList.size()-1) {
                //							last_item_date = quoteList.get(i).getCreatedAt();
                //						}
              }
            } else {
              row_quotes.add(
                  new RowQuote(
                      "Justin",
                      "hm, either you don't have internet connection or my database is down"));
            }

            row_adapter = new RowQuoteAdapter(context, row_quotes);
            list = (ListView) getActivity().findViewById(R.id.list);
            list.setAdapter(row_adapter);
          }
        });
  }
コード例 #2
0
 public ParseRequest addWhereExists(String key) {
   query.whereExists(key);
   return this;
 }