mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add try-catch framework for getting results from asynctask
This commit is contained in:
parent
bda5ddddd4
commit
95ccf0f5e2
1 changed files with 10 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
|
|
@ -127,8 +128,16 @@ public class CategorizationFragment extends Fragment {
|
||||||
String title = titleDesc.getString("Title", "");
|
String title = titleDesc.getString("Title", "");
|
||||||
Log.d(TAG, "Title: " + title);
|
Log.d(TAG, "Title: " + title);
|
||||||
|
|
||||||
//TODO: Add call to TitleCategories AsyncTask here and return ArrayList<String>
|
//TODO: How to get results?
|
||||||
|
TitleCategories asyncTask = new TitleCategories(title);
|
||||||
|
try {
|
||||||
|
items = asyncTask.execute().get();
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue