当前位置: 首页>>代码示例>>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;未经允许,请勿转载。