I am new to async tasks but I need to get a string from async task that is done in the background method for example
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
final MobileServiceList<AppDirectory> result =
mDirectoryTable.where().field("Family_Id").eq(11).execute().get();
for (AppDirectory item : result) {
//this is the string that I need to return
String neededstring = item.getheadofhousehold;
}
} catch (final Exception e) {
}
return null;
}
};
//I need "neededstring" to equal result
String result = task.execute();