当前位置: 首页>>代码示例>>Java>>正文


Java BinaryHttpResponseHandler类代码示例

本文整理汇总了Java中com.loopj.android.http.BinaryHttpResponseHandler的典型用法代码示例。如果您正苦于以下问题:Java BinaryHttpResponseHandler类的具体用法?Java BinaryHttpResponseHandler怎么用?Java BinaryHttpResponseHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BinaryHttpResponseHandler类属于com.loopj.android.http包,在下文中一共展示了BinaryHttpResponseHandler类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public static void get(Context context, String uString, BinaryHttpResponseHandler bHandler)   //下载数据使用,会返回byte数据
{
    if (isNetworkConnected(context)) {
        client.cancelRequests(context, true);
        client.get(uString, bHandler);
    } else {
        makeText(context);
    }

}
 
开发者ID:While1true,项目名称:JSSample,代码行数:11,代码来源:HttpUtils.java

示例2: post

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public static void post(Context context, String uString, BinaryHttpResponseHandler res) {
    if (isNetworkConnected(context)) {
        client.cancelRequests(context, true);
        client.post(uString, res);
    } else {
        makeText(context);
    }

}
 
开发者ID:While1true,项目名称:JSSample,代码行数:10,代码来源:HttpUtils.java

示例3: startLoad

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
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");

}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:29,代码来源:ImageLoadActivity.java

示例4: getTreeImage

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
private void getTreeImage(String name, BinaryHttpResponseHandler handler) {
    JSONObject photo = this.getMostRecentPhoto();
    if (photo != null) {
        String url = photo.optString(name);
        if (url != null) {
            RequestGenerator rg = new RequestGenerator();
            rg.getImage(url, handler);
        }
    }
}
 
开发者ID:OpenTreeMap,项目名称:otm-android,代码行数:11,代码来源:Plot.java

示例5: get

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public static void get(String uString, BinaryHttpResponseHandler bHandler) {
	client.get(uString, bHandler);
}
 
开发者ID:ranke,项目名称:HttpAsyncTest,代码行数:4,代码来源:HttpClientUtil.java

示例6: downloadAppCache

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public void downloadAppCache()
{

	AsyncHttpClient client = new AsyncHttpClient();
	client.get(url, new BinaryHttpResponseHandler(new String[] { ".*" /*"application/x-7z-compressed"*/}) {
			
	     @Override
	     public void onSuccess(byte[] data) {
	         // Successfully got a response
	    	 Log.d(TAG,"URL Downloaded: " + url);
	    	 _data = data;
	    	 new Thread(new Runnable() {
	    	        public void run() {
	   		    	 try {
	 					RemoteAppCacheRandomAccessMemory istream = new RemoteAppCacheRandomAccessMemory(_data);
	 					extractAppCache(istream, outputPath);
	 				} catch (IOException e) {
	 					// TODO Auto-generated catch block
	 					e.printStackTrace();
	 				}
	    	        }
	    	    }).start();
	     }
	     
	     @Override
	    public void onFinish() {
	    	// TODO Auto-generated method stub
	    	super.onFinish();
	    }
	     
	     @Override
	    public void onStart() {
	    	// TODO Auto-generated method stub
	    	super.onStart();
	    }

		@Override
		public void onFailure(int statusCode, Header[] headers, byte[] binaryData,
				Throwable error) {
			// TODO Auto-generated method stub
			Log.d(TAG,"Failed to download: " + url);
			super.onFailure(statusCode, headers, binaryData, error);
		}
	     
	 });	
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:47,代码来源:RemoteAppCache.java

示例7: onReceive

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
@Override
public void onReceive(final Context context, final Intent intent) {
	try {
		if (intent == null) {
			Log.d(TAG, "Receiver intent null");
		} else {
			String action = intent.getAction();
			if (action.equals(intentAction)) {
				JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
				Iterator<String> itr = json.keys();
				while (itr.hasNext()) {
					String key = (String) itr.next();
					if (key.equals(ViewProfileActivity.USER_ID_KEY)) {
						final long userId = json.getLong(key);
						final boolean inResponse = json.getBoolean(responseKey);
						final int notificationId = (int)userId;
						final String username = json.getString(alertKey);
						String jsonChatMessage = null;
						if (json.has(messageKey)) {
							jsonChatMessage = json.getString(messageKey);
						}
						final String chatMessage = jsonChatMessage;
						final String message = chatMessage != null ? chatMessage : (username + (inResponse ? " has accepted your request." : " has requested to connect with you."));
						final String skills = json.getString(skillsKey);
						final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
						final NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle()
						.setBigContentTitle(username).bigText(message)
						.setSummaryText(skills);
						final AsyncHttpClient client = new AsyncHttpClient();
						client.get(User.getProfileImageUrl(userId, 200), new BinaryHttpResponseHandler() {
							@Override
							public void onSuccess(byte[] fileData) {
								final Bitmap icon = UIUtils.decode(fileData);
								Intent pupInt = new Intent(context, chatMessage != null ? ChatActivity.class : ViewProfileActivity.class);
								pupInt.putExtra(ViewProfileActivity.USER_ID_KEY, userId);
								if (!inResponse && chatMessage == null) {
									DataService.addResponsePending(userId);
								}
								int requestID = (int) System.currentTimeMillis();
								pupInt.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); 
								PendingIntent contentIntent = PendingIntent.getActivity(context, requestID, pupInt, PendingIntent.FLAG_UPDATE_CURRENT);
								final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
								.setSmallIcon(R.drawable.ic_launcher)
								.setContentTitle(username)
								.setContentText(message)
								.setOnlyAlertOnce(true)
								.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
								.setAutoCancel(true)
								.setStyle(style)
								.setLargeIcon(icon)
								.setContentIntent(contentIntent);
								notificationManager.notify(notificationId, builder.build());
							}
						});
					}
				}
			}
		}

	} catch (JSONException e) {
		Log.d(TAG, "JSONException: " + e.getMessage());
	}
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:64,代码来源:MentorMeReceiver.java

示例8: get

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public static void get(String uString, BinaryHttpResponseHandler bHandler)   //下载数据使用,会返回byte数据
{
    client.get(uString, bHandler);
}
 
开发者ID:eoecn,项目名称:Libraries-for-Android-Developers,代码行数:5,代码来源:HttpUtil.java

示例9: getTreePhoto

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public void getTreePhoto(BinaryHttpResponseHandler handler) {
    getTreeImage(PHOTO_IMAGE, handler);
}
 
开发者ID:OpenTreeMap,项目名称:otm-android,代码行数:4,代码来源:Plot.java

示例10: getImage

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public void getImage(String imageUrl, BinaryHttpResponseHandler binaryHttpResponseHandler) {
    client.getImage(imageUrl, binaryHttpResponseHandler);
}
 
开发者ID:OpenTreeMap,项目名称:otm-android,代码行数:4,代码来源:RequestGenerator.java

示例11: getImage

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
public void getImage(String imageUrl, BinaryHttpResponseHandler handler) {
    if (imageUrl.startsWith("/")) {
        imageUrl = safePathJoin(baseUrl, imageUrl);
    }
    client.get(imageUrl, handler);
}
 
开发者ID:OpenTreeMap,项目名称:otm-android,代码行数:7,代码来源:RestClient.java

示例12: getTreeThumbnail

import com.loopj.android.http.BinaryHttpResponseHandler; //导入依赖的package包/类
/**
 * Get the most recent tree thumbnail for this plot, by way of an
 * asynchronous response handler.
 *
 * @param handler image handler which will receive callback from async http
 *                request
 */
public void getTreeThumbnail(BinaryHttpResponseHandler handler) {
    getTreeImage(PHOTO_THUMBNAIL, handler);
}
 
开发者ID:OpenTreeMap,项目名称:otm-android,代码行数:11,代码来源:Plot.java


注:本文中的com.loopj.android.http.BinaryHttpResponseHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。