本文整理汇总了Java中com.android.volley.toolbox.ImageRequest类的典型用法代码示例。如果您正苦于以下问题:Java ImageRequest类的具体用法?Java ImageRequest怎么用?Java ImageRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageRequest类属于com.android.volley.toolbox包,在下文中一共展示了ImageRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authCaptcha
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public static void authCaptcha(String session_id, final ModelListener<Bitmap> listener) {
// Build GET URL
// TODO: Find a better way
String url = baseURL + "/auth/captcha?session_id=";
try {
url += URLEncoder.encode(session_id, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
// Create ImageRequest, which automatically decodes image data
ImageRequest req = new ImageRequest(url, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
listener.onData(response, "ok");
}
}, 0, 0, ImageView.ScaleType.CENTER, Bitmap.Config.ARGB_4444, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
listener.onData(null, "获取验证码失败 :( 请重试几次");
}
});
SAGlobal.sharedRequestQueue.add(req);
}
示例2: UseImageRequest
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
private void UseImageRequest() {
ImageRequest imageRequest = new ImageRequest(
"http://img.my.csdn.net/uploads/201603/26/1458988468_5804.jpg",
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
iv_image.setImageBitmap(response);
}
}, 0, 0, Bitmap.Config.RGB_565, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
iv_image.setImageResource(R.drawable.ico_default);
}
});
mQueue.add(imageRequest);
}
示例3: getImage
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
void getImage(String ur){
Log.d("asasasa", ur);
ImageRequest imgRequest = new ImageRequest(ur,
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
thumbView.setImageBitmap(response);
}
}, 0, 0, null , null);
Volley.newRequestQueue(this).add(imgRequest);
/* Picasso.with(thumbView.getContext()).load(url)
//.onlyScaleDown()
// .centerCrop()
// .skipMemoryCache()
.memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_CACHE)
.into(thumbView);*/
}
示例4: callImageRequest
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void callImageRequest(){
imgURL= NewsPOGO.newsArray.get(position).image;
ImageRequest imageRequest=new ImageRequest(imgURL, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
NewsPOGO.newsArray.get(position).news_image=response;
}
}, 0, 0, ImageView.ScaleType.FIT_CENTER, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, "Error fetching image"+error.toString(), Toast.LENGTH_SHORT).show();;
}
});
MySingleton.getMyInstance(context).addToReqQue(imageRequest);
}
示例5: updateImageWithURL
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
private void updateImageWithURL(String imageURL) {
ImageRequest imageRequest = new ImageRequest(imageURL, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap bitmap) {
displayFinalImage(bitmap);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
displayCurrentShowImage();
}
});
imageRequest.setRetryPolicy(DataModel.getRetryPolicy());
VolleySingleton.getInstance(getActivity()).getRequestQueue().add(imageRequest);
}
示例6: displayCurrentShowImage
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
private void displayCurrentShowImage() {
ImageRequest imageRequest = new ImageRequest(currentShow.get("imageURL"), new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap bitmap) {
displayFinalImage(bitmap);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
displayDefaultImage();
}
});
imageRequest.setRetryPolicy(DataModel.getRetryPolicy());
VolleySingleton.getInstance(getActivity()).getRequestQueue().add(imageRequest);
}
示例7: ResimGetir
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void ResimGetir(){
//Resmi Alıcaz.
requestImage = new ImageRequest(avatarUrl, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
avatar.setImageBitmap(response);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
AppController.getInstance().addToRequestQueue(requestImage,"profilResimTag");
}
示例8: AvatarYukle
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void AvatarYukle(String avatar) {
imageRequest = new ImageRequest(avatar, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
circleImageView.setImageBitmap(response);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
AppController.getInstance().addToRequestQueue(imageRequest);
circleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (yazarID.getText() != null) {
Intent i = new Intent(BlogIcerikAcitivity.this, ProfilActivity.class);
i.putExtra(Kisi.PROFIL_ID, yazarID.getText());
startActivity(i);
}
}
});
}
示例9: setItemAvatar
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void setItemAvatar(String itemImage) {
ImageRequest im = new ImageRequest(itemImage, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
avatar.setImageBitmap(response);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
AppController.getInstance().addToRequestQueue(im);
}
示例10: makeImageRequest
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public static void makeImageRequest(Context context){
ImageView mImageView;
String url = "http://i.imgur.com/7spzG.png";
Response.Listener<Bitmap> listener = new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
//Do stuff here with bitmap
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
public void onErrorResponse(VolleyError error) {
//Do stuff with error
}
};
// Retrieves an image specified by the URL, displays it in the UI.
ImageRequest request = new ImageRequest(url, listener, 0, 0,
ImageView.ScaleType.FIT_XY, null, errorListener);
VolleySingleton.getInstance(context).addToRequestQueue(request);
}
示例11: getPicture
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
/**
* 根据得到的Url来请求图片
* @param url url
*/
private void getPicture(final String url){
new Thread(new Runnable() {
@Override
public void run() {
ImageRequest imageRequest = new ImageRequest(url, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
splash_img.setImageBitmap(response);
}
}, 0, 0, ImageView.ScaleType.CENTER_CROP,Bitmap.Config.RGB_565, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("Fetching img","Failed");
}
});
mQueue.add(imageRequest);
mQueue.start();
}
}).start();
}
示例12: getBitmapFromUrl
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
private void getBitmapFromUrl(String src, final int mode, final imgReqCallback ircb) {
RequestQueue queue = Volley.newRequestQueue(getBaseContext());
ImageRequest imgReq = new ImageRequest(src,
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
ircb.onSuccess(response);
if (mode==1){
Toast.makeText(getBaseContext(), "Wallpaper is set", Toast.LENGTH_SHORT).show();
}
}
}, 0, 0, null, Bitmap.Config.RGB_565,
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("VolleyImgErr", error.toString());
}
});
queue.add(imgReq);
}
示例13: onBindViewHolder
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
holder.name.setText(mDatas.get(position).getTitle());
holder.author.setText("作者: " + mDatas.get(position).getAuthor());
holder.intro.setText(mDatas.get(position).getIntro());
holder.state.setText(mDatas.get(position).getUpdateState());
holder.imgButton.setImageResource(R.drawable.loading);
ImageRequest imageRequest = new ImageRequest(
mDatas.get(position).getImgUrl(),
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap bitmap) {
holder.imgButton.setImageBitmap(bitmap);
}
}, 0, 0, Bitmap.Config.RGB_565, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
holder.imgButton.setImageResource(R.drawable.loading_error);
}
}
);
mQueue.add(imageRequest);
}
示例14: loadImage
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void loadImage(String url, final ImageView imageView){
thisImageview = imageView;
Log.i("Image Url", url);
if(User.instance().getPrimaryKey() != -1) {
RequestQueue requestQueue = Volley.newRequestQueue(mainActivity);
ImageRequest imageRequest = new ImageRequest(url, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
thisImageview.setImageBitmap(getCircularBitmap(response));
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestQueue.add(imageRequest);
}
}
示例15: loadImagenocrop
import com.android.volley.toolbox.ImageRequest; //导入依赖的package包/类
public void loadImagenocrop(String url, final ImageView imageView){
thisImageview = imageView;
Log.i("Image Url", url);
RequestQueue requestQueue = Volley.newRequestQueue(mainActivity);
ImageRequest imageRequest = new ImageRequest(url, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
thisImageview.setBackgroundColor(Color.parseColor("#00FFFFFF"));
thisImageview.setImageBitmap(response);
}
}, 0, 0, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestQueue.add(imageRequest);
}