com.loopj.android.http.BinaryHttpResponseHandler Java Examples

The following examples show how to use com.loopj.android.http.BinaryHttpResponseHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageLoadActivity.java    From android-opensource-library-56 with Apache License 2.0 6 votes vote down vote up
private void startLoad() {
    AsyncHttpClient client = new AsyncHttpClient();

    client.get(
            "http://farm3.staticflickr.com/2004/2249945112_caa85476ef_o.jpg",
            new BinaryHttpResponseHandler() {
                @Override
                public void onSuccess(byte[] binaryData) {
                    Log.d(TAG, "onSuccess");
                    Bitmap bitmap = BitmapFactory.decodeByteArray(
                            binaryData, 0, binaryData.length);
                    ImageView imageView = ((ImageView) findViewById(R.id.image));
                    imageView.setImageBitmap(bitmap);
                    imageView.setVisibility(View.VISIBLE);
                    findViewById(R.id.progress).setVisibility(View.GONE);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    error.printStackTrace();
                    Log.d(TAG, "onFailure");
                }
            });

    RequestParams param = new RequestParams();
    param.put("hpge", "fuga");

}
 
Example #2
Source File: HttpClientUtil.java    From HttpAsyncTest with Apache License 2.0 4 votes vote down vote up
public static void get(String uString, BinaryHttpResponseHandler bHandler) {
	client.get(uString, bHandler);
}
 
Example #3
Source File: HttpClientUtil.java    From HttpAsyncTest with Apache License 2.0 4 votes vote down vote up
public static void get(String urlString, RequestParams params,
		BinaryHttpResponseHandler bHandler) {
	client.get(urlString, params, bHandler);
}
 
Example #4
Source File: HttpUtil.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public static void get(String uString, BinaryHttpResponseHandler bHandler)   //下载数据使用,会返回byte数据
{
    client.get(uString, bHandler);
}