Skip to content

Commit 95ccf0f

Browse files
committed
Add try-catch framework for getting results from asynctask
1 parent bda5ddd commit 95ccf0f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.util.List;
4646
import java.util.Set;
4747
import java.util.concurrent.CountDownLatch;
48+
import java.util.concurrent.ExecutionException;
4849
import java.util.concurrent.ScheduledThreadPoolExecutor;
4950

5051
import fr.free.nrw.commons.CommonsApplication;
@@ -127,8 +128,16 @@ protected ArrayList<String> titleCatQuery() {
127128
String title = titleDesc.getString("Title", "");
128129
Log.d(TAG, "Title: " + title);
129130

130-
//TODO: Add call to TitleCategories AsyncTask here and return ArrayList<String>
131+
//TODO: How to get results?
132+
TitleCategories asyncTask = new TitleCategories(title);
133+
try {
134+
items = asyncTask.execute().get();
135+
} catch (ExecutionException e) {
136+
137+
} catch (InterruptedException e) {
131138

139+
}
140+
return items;
132141
}
133142

134143
/**

0 commit comments

Comments
 (0)