Java Code Examples for com.android.volley.toolbox.NetworkImageView#setErrorImageResId()
The following examples show how to use
com.android.volley.toolbox.NetworkImageView#setErrorImageResId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetworkImageViewAdapter.java From android-open-project-demo with Apache License 2.0 | 5 votes |
@Override void setImage(ImageView imageView, String imageUrl) { NetworkImageView networkImageView=(NetworkImageView)imageView; networkImageView.setDefaultImageResId(R.drawable.ic_empty); networkImageView.setErrorImageResId(R.drawable.ic_empty); networkImageView.setImageUrl(StringUtil.preUrl(imageUrl), imageLoader); }
Example 2
Source File: NetworkImageViewActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_network_image_view); RequestQueue queue = Volley.newRequestQueue(this); ImageLoader loader = new ImageLoader(queue, new NoImageCache()); String url = "http://farm6.staticflickr.com/5026/5735032857_68a332481e_z.jpg"; NetworkImageView imageView = (NetworkImageView) findViewById(R.id.image); imageView.setDefaultImageResId(R.drawable.ic_launcher); imageView.setErrorImageResId(R.drawable.ic_launcher); imageView.setImageUrl(url, loader); }
Example 3
Source File: BaseLearningActivity.java From allenglish with Apache License 2.0 | 4 votes |
private void addView(List<LeanCloudApiBean.ResultsEntity> list) { LayoutInflater inflater = LayoutInflater.from(mContext); //实例化一个LinearLayout LinearLayout linear = new LinearLayout(this); //设置LinearLayout属性(宽和高) LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 120); //将以上的属性赋给LinearLayout linear.setLayoutParams(layoutParams); ImageLoader imageLoader = new ImageLoader(VolleySingleton.getInstance().getRequestQueue(), BaseApplication.getInstance().getBitmapCache()); for (final LeanCloudApiBean.ResultsEntity lc : list) { // 获取需要添加的布局 CardView layout = (CardView) inflater.inflate( R.layout.item_article_list, linear).findViewById(R.id.card_view); if (layout.getParent() != null) ((LinearLayout) layout.getParent()).removeView(layout); // <- fix // 将布局加入到当前布局中 linearLayout.addView(layout); TextView title = (TextView) layout.findViewById(R.id.title); TextView source = (TextView) layout.findViewById(R.id.source); NetworkImageView picture = (NetworkImageView) layout.findViewById(R.id.picture); if (lc.type == 0) { title.setText(lc.title); try { source.setText(lc.source + " " + TimeUtils.DATE_FORMAT_DATE.format(TimeUtils.FULL_DATE_FORMAT_DATE.parse(lc.postTime.iso))); } catch (ParseException e) { e.printStackTrace(); } if (isShowPicture) { if (lc.imageUrl.isEmpty()) { picture.setVisibility(View.GONE); } else { picture.setVisibility(View.VISIBLE); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); picture.setImageUrl(lc.imageUrl, imageLoader); } } else { picture.setVisibility(View.GONE); } layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = getIntent(); intent.putExtra("BEAN", lc); intent.putExtra("TABLE_NAME", tableName); intent.putExtra("BILINGUAL_READING_TAG", bilingualReadingTag); finish(); startActivity(intent); } }); } else { NativeADDataRef nativeADDataRef = lc.nativeADDataRef; title.setText(nativeADDataRef.getTitle() != null ? nativeADDataRef.getTitle() : nativeADDataRef.getSubTitle()); source.setText("广告"); if (isShowPicture) { picture.setImageUrl(nativeADDataRef.getImage(), imageLoader); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); } else { picture.setVisibility(View.GONE); } CommonUtils.setAds(layout, lc.iflyNativeAd, nativeADDataRef); adCardView = layout; nativeADDataRef2 = nativeADDataRef; } } }
Example 4
Source File: HorizontalImageRecyclerViewAdapter.java From Netease with GNU General Public License v3.0 | 4 votes |
private void setNetworkImageView(NetworkImageView networkImageView, String url) { networkImageView.setDefaultImageResId(defaultImage); networkImageView.setErrorImageResId(defaultImage); networkImageView.setImageUrl(url, MySingleton.getInstance(mContext.getApplicationContext()).getImageLoader()); }
Example 5
Source File: NormalRecyclerViewAdapter.java From Netease with GNU General Public License v3.0 | 4 votes |
private void setNetworkImageView(NetworkImageView networkImageView, String url) { networkImageView.setDefaultImageResId(defaultImage); networkImageView.setErrorImageResId(defaultImage); networkImageView.setImageUrl(url, MySingleton.getInstance(mContext.getApplicationContext()).getImageLoader()); }