I want to display specific data in a listview from a database's column using parse.com, i just don't know how to specifically do that,following is the code there is an error here but you can change it completely to solve it !
public class Donar_Acceptor_list extends ListActivity {
// Declare Variables
ListView listview;
List<ParseObject> ob;
// ProgressDialog mProgressDialog; ArrayAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the view from listview_main.xml
setContentView(R.layout.donar_acceptor_list);
// Execute RemoteDataTask AsyncTask
// new RemoteDataTask().execute();
}
protected Void doInBackground(Void... params) throws com.parse.ParseException {
// Locate the class table named "Country" in Parse.com
ParseQuery<ParseObject> query = ParseQuery.getQuery("DonAcc");
query.whereEqualTo("DonAcc", "donar");
// ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
// "username");
query.orderByDescending("_created_at");
try {
ob = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
protected void onPostExecute(Void result) {
// Locate the listview in listview_main.xml
listview = (ListView) findViewById(R.id.list);
// Pass the results into an ArrayAdapter
adapter = new ArrayAdapter<String>(Donar_Acceptor_list.this,
R.layout.donar_aceptor_discription);
// Retrieve object "name" from Parse.com database
for (ParseObject status : ob) {
adapter.add((String) status.get("name"));
}
listview.setAdapter(adapter); } }