Back to project page dw2020.
The source code is released under:
Apache License
If you think the Android project dw2020 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.fivehundredpx.api.tasks; //from w w w . j a va 2 s . com import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.util.Log; import com.fivehundredpx.api.PxApi; public class UserDetailTask extends AsyncTask<Object, Void, JSONObject> { private static final String TAG = "UserDetailTask"; private String url = "/users.json"; public interface Delegate { public void onSuccess(JSONObject user); public void onFail(); } private Delegate _d; public UserDetailTask(Delegate d) { this._d = d; } @Override protected JSONObject doInBackground(Object... params) { final PxApi api = (PxApi) params[0]; final JSONObject obj = api.get(url); try { return obj.getJSONObject("user"); } catch (JSONException e) { Log.e(TAG, "", e); _d.onFail(); return null; } } @Override protected void onPostExecute(JSONObject result) { if (result != null) _d.onSuccess(result); } }