本文整理匯總了Java中com.android.volley.toolbox.ImageLoader.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageLoader.get方法的具體用法?Java ImageLoader.get怎麽用?Java ImageLoader.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.android.volley.toolbox.ImageLoader
的用法示例。
在下文中一共展示了ImageLoader.get方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: savePrepared
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public static void savePrepared() {
if (prepared == null)
throw new RuntimeException("No ImageItem prepared");
Toast.makeText(Global.baseActivity, "Saving...", Toast.LENGTH_SHORT).show();
System.out.println("Proceeding to save item " + prepared.getId() + " " + prepared.getTitle());
ImageLoader loader = VolleySingleton.getInstance(null).getImageLoader();
loader.get(prepared.getRequestUrl(), new ImageLoader.ImageListener() {
@Override
public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
if (response.getBitmap() == null)
makeError();
else {
saveBitmapOnLocal(response.getBitmap());
}
}
@Override
public void onErrorResponse(VolleyError error) {
makeError();
}
});
}
示例2: VolleyDataSource
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public VolleyDataSource(
final ImageLoader imageLoader,
final Uri imageRequest,
final AbstractDraweeControllerBuilder.CacheLevel cacheLevel) {
String uriString = imageRequest.toString();
int maxWidth = 0;
int maxHeight = 0;
if (cacheLevel != AbstractDraweeControllerBuilder.CacheLevel.FULL_FETCH) {
if (!imageLoader.isCached(uriString, maxWidth, maxHeight)) {
mImageContainer = null;
setFailure(new NullPointerException("Image not found in bitmap-cache."));
return;
}
}
mImageContainer = imageLoader.get(
uriString,
new ImageLoader.ImageListener() {
@Override
public void onErrorResponse(VolleyError error) {
setFailure(error.getCause());
}
@Override
public void onResponse(final ImageLoader.ImageContainer response, boolean isImmediate) {
if (response.getBitmap() != null) {
setResult(response.getBitmap(), true);
}
}
},
maxWidth,
maxHeight);
}
示例3: setNonExistingUserImage
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
private void setNonExistingUserImage(final String createdUsername, final TextView textView) {
Drawable profileRoundedDrawableImage = mCachedImages.get(createdUsername);
if (profileRoundedDrawableImage == null) {
ImageLoader imageLoader = VolleyRequestQueue.getInstance().getImageLoader();
imageLoader.get(RESTGetPhoto.getURL(createdUsername), new ImageLoader.ImageListener() {
@Override
public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
if (response.getBitmap() != null) {
Drawable profileDrawableImage = convertProfileImageToRoundedDrawable(response.getBitmap());
textView.setCompoundDrawablesWithIntrinsicBounds(null, profileDrawableImage, null, null);
mCachedImages.put(createdUsername, profileDrawableImage);
} else {
textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_profile_default_small, 0, 0);
mCachedImages.put(createdUsername, textView.getCompoundDrawables()[1]);
}
}
@Override
public void onErrorResponse(VolleyError error) {
textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_profile_default_small, 0, 0);
mCachedImages.put(createdUsername, textView.getCompoundDrawables()[1]);
}
});
} else {
textView.setCompoundDrawablesWithIntrinsicBounds(null, profileRoundedDrawableImage, null, null);
}
}
示例4: completeBaseInfo
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public void completeBaseInfo(String data) {
if(data != null) {
Map<String,String> map = Utils.cutDoubanData(data);
if(map.size() > 0 ) {
try{
//得到了正確的圖書信息
etDescription.setText(map.get("summary"));
etAuthor.setText(map.get("author"));
String originPrice = map.get("price");
originPrice = originPrice.replace("元","");
etOPrice.setText(originPrice);
etBookName.setText(map.get("title"));
etPublisher.setText(map.get("publisher"));
ImageLoader loader = Mysingleton.getInstance(context).getImageLoader();
int w = getResources().getDimensionPixelSize(R.dimen.img_cover_width);
int h = getResources().getDimensionPixelSize(R.dimen.img_cover_height);
coverDouBanUrl = map.get("image").replaceAll("\\\\","");
loader.get(coverDouBanUrl,ImageLoader.getImageListener(imgCover,R.drawable.def,R.drawable.def),w,h);
if(!btnAddCover.getText().toString().equals("更改封麵"))
btnAddCover.setText("更改封麵");
loader = null;
}catch (NullPointerException e) {
Log.e("SellFragment","error in completeBaseInfo",e);
//沒有查到該圖書信息
Toast.makeText(context,"查詢圖書信息失敗!lalal",Toast.LENGTH_SHORT).show();
}
}
map = null;
}
data = null;
}
示例5: loadImage
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
/**
* 限製圖片的寬高,如果w,h的參數為0,則不壓縮
* @param imageView
* @param url
* @param w
* @param h
*/
public static void loadImage(ImageView imageView, String url,int w,int h) {
ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView,
R.drawable.default_avatar_ori, R.drawable.default_avatar_ori);
ImageLoader imageLoader = new ImageLoader(queue, new BitmapCache());
if (w<=0||h<=0){
imageLoader.get(url, listener);
}else{
imageLoader.get(url, listener,w,h);
}
}
示例6: get_imageloader
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
private void get_imageloader()
{
textview.setText("獲取圖片開始了");
networkImageView.setImageBitmap(null);
imageView.setImageBitmap(null);
String url = "http://g.hiphotos.baidu.com/image/pic/item/21a4462309f790521631d9e908f3d7ca7bcbd53f.jpg";
ImageLoader loader = new ImageLoader(MyApplication.getHttpQueues(), new BitmapCache());
ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView, R.drawable.default_icon , R.drawable.error );
loader.get(url, listener);
}
示例7: getImage
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public static void getImage(String imgUrl, ImageView view) {
initRequestQueue();
ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
ImageLoader.ImageListener listener = ImageLoader.getImageListener(view, R.mipmap.loading, R.mipmap.email);
imageLoader.get(imgUrl,listener);
}
示例8: getUserPhoto
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public static void getUserPhoto(String imgUrl, ImageView view) {
initRequestQueue();
ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
ImageLoader.ImageListener listener = ImageLoader.getImageListener(view, R.mipmap.profile_picture, R.mipmap.profile_picture);
imageLoader.get(imgUrl,listener);
}
示例9: UseImageLoader
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
private void UseImageLoader() {
ImageLoader imageLoader = new ImageLoader(mQueue, new BitmapCache());
ImageLoader.ImageListener listener = ImageLoader.getImageListener(iv_image, R.drawable.ico_default, R.drawable.ico_default);
imageLoader.get("http://img.my.csdn.net/uploads/201603/26/1458988468_5804.jpg", listener);
}
示例10: getImage
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public void getImage(ImageView imageView, String url) {
ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView,
R.drawable.default_picture, R.drawable.default_picture);
imageLoader.get(url, listener);
}
示例11: onCreate
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mJokeTextView = (TextView) findViewById(R.id.joke);
// this is only for the sake of this example. Is common practice to use
// a singleton to instantiate this once on a global scope
mRequestQueue = Volley.newRequestQueue(this.getApplicationContext());
mHttpUrlConnectionImageView = (ImageView) findViewById(R.id.httpurlconnection_image_view);
new HttpURLConnectionImageAsyncTask(mHttpUrlConnectionImageView).execute(IMAGE_URL);
mVolleyImageView = (ImageView) findViewById(R.id.volley_image_request_view);
// you can use an image request and set the downloaded image on the onResponse callback
// or set an error image or placeholder when the call fails
ImageRequest imageRequest = new ImageRequest(IMAGE_URL, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
mVolleyImageView.setImageBitmap(response);
}
},
0,
0,
ImageView.ScaleType.CENTER_CROP,
null,
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// show an error drawable
mVolleyImageView.setImageDrawable(getDrawable(R.drawable.error));
}
}){
@Override
public Priority getPriority(){
return Priority.LOW;
}
};
// add the ImageRequest to the Volleys request queue
mRequestQueue.add(imageRequest);
// You can also user an ImageLoader with your custom ImageCache implementation
mVolleyImageLoaderImageView = (ImageView) findViewById(R.id.volley_imageloader_view);
mImageLoader = new ImageLoader(mRequestQueue, new LruBitmapCache(LruBitmapCache.getCacheSize(this)));
mImageLoader.get(IMAGE_URL, ImageLoader.getImageListener(mVolleyImageLoaderImageView, R.mipmap.ic_launcher, R.drawable.error));
// for super lazy programmers, you can use NetworkImageView in your View hierarchy that handles
// request lifecycle for you
mNetworkImageView = (NetworkImageView) findViewById(R.id.network_image_view);
mNetworkImageView.setImageUrl(IMAGE_URL, mImageLoader);
mNetworkImageView.setDefaultImageResId(R.mipmap.ic_launcher);
mNetworkImageView.setErrorImageResId(R.drawable.error);
}