Back to project page unicef_gis_mobile.
The source code is released under:
MIT License
If you think the Android project unicef_gis_mobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.unicef.gis.ui; /*from ww w .j a v a 2 s. c om*/ import java.util.List; import org.unicef.gis.infrastructure.ServerUrlPreferenceNotSetException; import org.unicef.gis.infrastructure.UnicefGisApi; import org.unicef.gis.infrastructure.data.UnicefGisStore; import org.unicef.gis.model.Tag; import android.os.AsyncTask; public class FetchTagsTask extends AsyncTask<Void, Void, Integer> { public static final Integer RESULT_SUCCESS = 0; public static final Integer SERVER_URL_PREFERENCE_NOT_SET = 1; private final FetchTagsActivity context; public FetchTagsTask(FetchTagsActivity context) { this.context = context; } @Override protected Integer doInBackground(Void... arg0) { try { UnicefGisApi api = new UnicefGisApi(context); List<Tag> tags = api.getTags(); UnicefGisStore store = new UnicefGisStore(context); store.saveTags(tags); } catch (ServerUrlPreferenceNotSetException e) { return SERVER_URL_PREFERENCE_NOT_SET; } return RESULT_SUCCESS; } @Override protected void onPostExecute(Integer result) { context.onFetchTagsResult(result); } }