Reputation: 107
So this is a very basic question but I've really hit a roadblock here. I've attempted quite a few things but I can't really understand how to extract the data from my parse table and get it into my app. I went through all the tutorials and still can't connect the dots.
What I'm trying to do is the following:
I want my app to be able to display every persons name who has a "human"
designation. I've tried the following base code:
ParseQuery<ParseObject> query = ParseQuery.getQuery("PersonClass");
query.whereEqualTo("PersonType","human");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> personList, ParseException e) {
if (e == null) {
***HERE IS WHERE I"M CONFUSED ABOUT HOW TO EXTRACT THE DATA!!!!**
} else {
}
}
});
So the results I WOULD LIKE to see would be a return of "Steve"
and "Gary"
as they are both human
designations
Where do I input data to point it towards searching through the specific column of "PersonsName"
and then once it is pointed in that direction, how would I extract that data from this?
Upvotes: 0
Views: 441
Reputation: 1077
Try this :
ParseQuery<ParseObject> query = ParseQuery.getQuery("PersonClass");
query.whereEqualTo("PersonType","human");
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> personList, ParseException e) {
if (e == null) {
if(personList.size()>0 ){
for (ParseObject person : personList) {
String pearsonName=person.getString("PersonsName");
}
}else{
// No records found
}
} else {
//Handle the exception
}
}
});
Upvotes: 1
Reputation: 6834
do like this
get every Person object from list and get
PearsonName
from thatPearson
object
ParseQuery<ParseObject> query = ParseQuery.getQuery("PersonClass");
query.whereEqualTo("PersonType","human");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> personList, ParseException e) {
if (e == null && personList.size() > 0) {
for (ParseObject person : personList) {
String pearsonName=personList.getString("PearsonName");
}
} else {
}
}
});
Upvotes: 1