Created
May 16, 2014 18:38
-
-
Save hboregio/276715ccafbc5cf94f33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.loopj.android.http.AsyncHttpResponseHandler; | |
/** | |
* Singleton RestClient | |
*/ | |
public class RestClient { | |
private static RestClient sInstance = null; | |
public static RestClient getInstance() { | |
return RestClient.getInstance(); | |
} | |
public static RestClient getInstance() { | |
if (sInstance == null) { | |
sInstance = new RestClient(); | |
} | |
return sInstance; | |
} | |
public void getFeed(final ResultsListener<String> aListener) { | |
ChoosyAPI.get("feed/", null, new AsyncHttpResponseHandler() { | |
@Override | |
public void onSuccess(int statusCode, String content) { | |
if (statusCode == 200) { | |
aListener.onSuccess(content); | |
} | |
} | |
@Override | |
public void onFailure(Throwable e, String response) { | |
aListener.onFailure(e); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment