I develop a message application using parse.com, there is a few class my data browser in parse com.
If class type custom, i can bind data's in column to my list view. Is class type User or Installation, i can't get my datas and bind to listview. I guess there is a security rule about this. well, how can i get values for "User" and "Installation" class type?
there is my codes, what can i add this?
@Override
protected Void doInBackground(Void... params) {
// Locate the class table named "User" in Parse.com
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
"User");
//query.orderByDescending("_created_at");
try {
ob = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// Locate the listview in listview_main.xml
listview = (ListView) findViewById(R.id.listview);
// Pass the results into an ArrayAdapter
adapter = new ArrayAdapter<String>(MainActivity.this,
R.layout.listview_item);
// Retrieve object "name" from Parse.com database
for (ParseObject users : ob) {
adapter.add((String) users.get("username"));
}
// Binds the Adapter to the ListView
listview.setAdapter(adapter);
// Close the progressdialog
mProgressDialog.dismiss();
// Capture button clicks on ListView items
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// Send single item click data to SingleItemView Class
Intent i = new Intent(MainActivity.this,
SingleItemView.class);
// Pass data "username" followed by the position
i.putExtra("username", ob.get(position).getString("username")
.toString());
// Open SingleItemView.java Activity
startActivity(i);
}
});
}