當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageRequest類代碼示例

本文整理匯總了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);
}
 
開發者ID:njitdev,項目名稱:sa-android,代碼行數:25,代碼來源:SchoolSystemModels.java

示例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);
}
 
開發者ID:henrymorgen,項目名稱:android-advanced-light,代碼行數:17,代碼來源:MainActivity.java

示例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);*/
}
 
開發者ID:prabhavgupta,項目名稱:BookED,代碼行數:21,代碼來源:EnterDetails.java

示例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);

}
 
開發者ID:goutham-kalikrishna,項目名稱:ShotsNewsApp,代碼行數:18,代碼來源:GetNewsImageAsync.java

示例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);
}
 
開發者ID:dylanmaryk,項目名稱:InsanityRadio-Android,代碼行數:17,代碼來源:FragmentNowPlaying.java

示例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);
}
 
開發者ID:dylanmaryk,項目名稱:InsanityRadio-Android,代碼行數:17,代碼來源:FragmentNowPlaying.java

示例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");

    }
 
開發者ID:Turkcell,項目名稱:GYAppAnd,代碼行數:21,代碼來源:ProfilFragment.java

示例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);
            }
        }
    });
}
 
開發者ID:Turkcell,項目名稱:GYAppAnd,代碼行數:27,代碼來源:BlogIcerikAcitivity.java

示例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);
}
 
開發者ID:Turkcell,項目名稱:GYAppAnd,代碼行數:17,代碼來源:RecyclerAdapterBlog.java

示例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);
}
 
開發者ID:PGMacDesign,項目名稱:PGMacTips,代碼行數:22,代碼來源:VolleyCalls.java

示例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();
}
 
開發者ID:Jameeeees,項目名稱:Simplified-Zhihu-Daily,代碼行數:25,代碼來源:SplashActivity.java

示例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);

}
 
開發者ID:WenhaoWu,項目名稱:BingWallpaper,代碼行數:23,代碼來源:View_ImageFullActivity.java

示例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);

}
 
開發者ID:hanFengSan,項目名稱:Yakami-manga,代碼行數:25,代碼來源:SearchActivity.java

示例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);
    }
}
 
開發者ID:CE-KMITL-OOAD-2015,項目名稱:Move-Alarm_ORCA,代碼行數:20,代碼來源:Transfer.java

示例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);
}
 
開發者ID:CE-KMITL-OOAD-2015,項目名稱:Move-Alarm_ORCA,代碼行數:19,代碼來源:Transfer.java


注:本文中的com.android.volley.toolbox.ImageRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。