Back to project page Common-Library.
The source code is released under:
Apache License
If you think the Android project Common-Library 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 com.morgan.library.task; /* w w w . j a va 2s .c o m*/ import android.os.AsyncTask; import com.morgan.library.async.IFeedback; import com.morgan.library.model.NetResult; import com.morgan.library.model.Weather; import com.morgan.library.net.ApiManager; public class GetWeatherTask extends AsyncTask<Double, Void, Object> { public static final String FEED_BACK_KEY = GetWeatherTask.class.getName(); private IFeedback feedback; private boolean mIsSuccess = false; public GetWeatherTask(IFeedback feedback) { this.feedback = feedback; } @Override protected Object doInBackground(Double... params) { double lat = params[0]; double lon = params[1]; NetResult<Weather> result = ApiManager.getApiClient().getWeather(lat, lon); if (result.isSuccess()) { mIsSuccess = true; return result.getObject(); } return result.getErrorMessage(); } @Override protected void onPostExecute(Object result) { feedback.onFeedback(FEED_BACK_KEY, mIsSuccess, result); } }