本文整理匯總了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);
}