Back to project page photos.
The source code is released under:
MIT License
If you think the Android project photos 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.ericfarraro.sdk.util; // w w w . j a v a 2 s.co m import android.os.AsyncTask; import com.ericfarraro.sdk.interfaces.UrlContentRetrieved; import java.io.IOException; /** * Created by Eric on 10/7/2014. */ public class UrlFetchTask extends AsyncTask<String, Void, String> { protected UrlContentRetrieved mListener; public UrlContentRetrieved getListener() { return mListener; } public void setListener(UrlContentRetrieved listener) { mListener = listener; } @Override protected String doInBackground(String... params) { try { String content = new String(Utility.getBytesForUrl(params[0])); return content; } catch(IOException e) { return null; } } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(mListener != null) mListener.onUrlContentRetrieved(s); } }