本文整理汇总了Java中com.android.volley.toolbox.NetworkImageView.setErrorImageResId方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkImageView.setErrorImageResId方法的具体用法?Java NetworkImageView.setErrorImageResId怎么用?Java NetworkImageView.setErrorImageResId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.volley.toolbox.NetworkImageView
的用法示例。
在下文中一共展示了NetworkImageView.setErrorImageResId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
//Get the data model based on position
Book book = mBooks.get(position);
// Setting item views based on my views and data model
TextView textViewName = holder.nameTextView;
textViewName.setText(book.getBookName());
TextView textViewAuthor = holder.authorTextView;
final NetworkImageView image = holder.bookImage;
ImageLoader mImageLoader = MySingleton.getInstance(mContext).getImageLoader();
image.setImageUrl(book.getBookImgUrl(), mImageLoader);
image.setErrorImageResId(R.drawable.defaultcover);
}
示例2: getView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
RelativeLayout view = (RelativeLayout) convertView;
if (view == null) {
LayoutInflater inflater = getLayoutInflater();
view = (RelativeLayout)inflater.inflate(R.layout.home_row, parent, false);
}
String username = accountUsers[position];
view.setId(Integer.valueOf(accountIDs[position]));
TextView blogName = (TextView)view.findViewById(R.id.blogName);
TextView blogUsername = (TextView)view.findViewById(R.id.blogUser);
NetworkImageView blavatar = (NetworkImageView)view.findViewById(R.id.blavatar);
blogName.setText(
StringUtils.unescapeHTML(blogNames[position]));
blogUsername.setText(
StringUtils.unescapeHTML(username));
blavatar.setErrorImageResId(R.drawable.blavatar_placeholder);
blavatar.setImageUrl(blavatars[position], WordPress.imageLoader);
return view;
}
示例3: getView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
convertView = inflater.inflate(mResourceId, parent, false);
}
CloudMemeMeme meme = getItem(position);
if (meme != null && convertView != null) {
NetworkImageView image = (NetworkImageView) convertView.findViewById(R.id.meme_image);
String imageUrl = meme.getImageUrl();
Log.d(TAG, "Requesting Image: " + imageUrl);
image.setContentDescription(meme.getText());
image.setImageUrl(imageUrl, mVolley.getImageLoader());
image.setDefaultImageResId(R.drawable.ic_action_camera_wide);
image.setErrorImageResId(R.drawable.ic_action_camera_wide);
TextView scoreDisplay = (TextView) convertView.findViewById(R.id.meme_score);
int score = 0; // TODO: Replace with score from API when available
scoreDisplay.setText("+" + score);
View voteButton = convertView.findViewById(R.id.meme_vote_button);
voteButton.setOnClickListener(this);
voteButton.setTag(position);
}
return convertView;
}
示例4: getView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
convertView = inflater.inflate(mResourceId, parent, false);
}
CloudMemeTemplate meme = getItem(position);
if (meme != null && convertView != null) {
markView(convertView, mSelected == position);
NetworkImageView image =
(NetworkImageView) convertView.findViewById(R.id.meme_template_image);
String imageUrl = meme.getUrl();
Log.d(TAG, "Requesting template: " + imageUrl);
image.setImageUrl(imageUrl, mVolley.getImageLoader());
image.setDefaultImageResId(R.drawable.ic_action_camera_wide);
image.setErrorImageResId(R.drawable.ic_action_camera_wide);
}
return convertView;
}
示例5: getGroupView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
EventoContainer evento = getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) _act
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.listitem, null);
}
if (imageLoader == null)
imageLoader = AppController.getInstance().getImageLoader();
NetworkImageView thumbNail = (NetworkImageView) convertView
.findViewById(R.id.thumbnail);
thumbNail.setDefaultImageResId(R.drawable.loader);
thumbNail.setErrorImageResId(R.drawable.loader);
TextView eventoNome = (TextView)convertView.findViewById(R.id.textView1);
TextView eventoDesc = (TextView)convertView.findViewById(R.id.textView2);
eventoNome.setText(evento.getEventoNome());
eventoDesc.setText(evento.getEventoDesc());
thumbNail.setImageUrl(evento.getImageLink(), imageLoader);
return convertView;
}
示例6: ChildViewBuffer
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
ChildViewBuffer(View v) {
mImageView = (NetworkImageView) v.findViewById(R.id.ImageView);
mImageView.setErrorImageResId(R.drawable.logo);
mTitleText = (TextView) v.findViewById(R.id.Title);
mNumText = (TextView) v.findViewById(R.id.Num);
iImageLoader = VolleyLoader.getInstance().getImageLoader();
iImageListener = new ImageListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("TAG", "onErrorResponse():" + error);
}
@Override
public void onResponse(ImageContainer response,
boolean isImmediate) {
Log.d("TAG", "onResponse():" + isImmediate);
}
};
}
示例7: setImage
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@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);
}
示例8: onBindViewHolder
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
//Get the data model based on position
Book book = mBooks.get(position);
// Setting item views based on my views and data model
TextView textView = holder.nameTextView;
textView.setText(book.getBookName());
final NetworkImageView image = holder.bookImage;
ImageLoader mImageLoader = MySingleton.getInstance(mContext).getImageLoader();
image.setImageUrl(book.getBookImgUrl(), mImageLoader);
image.setErrorImageResId(R.drawable.defaultcover);
}
示例9: loadNetworkImage
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
private void loadNetworkImage(Cursor cursor, NetworkImageView imageView) {
String thumbnailURL = cursor.getString(cursor.getColumnIndex(WordPressDB.COLUMN_NAME_THUMBNAIL_URL));
// Allow non-private wp.com and Jetpack blogs to use photon to get a higher res thumbnail
if (mIsCurrentBlogPhotonCapable){
String imageURL = cursor.getString(cursor.getColumnIndex(WordPressDB.COLUMN_NAME_FILE_URL));
if (imageURL != null) {
thumbnailURL = PhotonUtils.getPhotonImageUrl(imageURL, mGridItemWidth, 0);
}
}
if (thumbnailURL != null) {
Uri uri = Uri.parse(thumbnailURL);
String filepath = uri.getLastPathSegment();
int placeholderResId = WordPressMediaUtils.getPlaceholder(filepath);
imageView.setImageResource(0);
imageView.setErrorImageResId(placeholderResId);
// no default image while downloading
imageView.setDefaultImageResId(0);
if (MediaUtils.isValidImage(filepath)) {
imageView.setTag(thumbnailURL);
imageView.setImageUrl(thumbnailURL, mImageLoader);
} else {
imageView.setImageResource(placeholderResId);
}
} else {
imageView.setImageResource(0);
}
}
示例10: onCreate
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView=(ImageView) findViewById(R.id.iVi_image);
VolleyUtil.disPlayImage(MainActivity.this, imageView, "https://raw.githubusercontent.com/GankLun/VolleyUtils/master/volley.jpg", R.drawable.ic_launcher, R.drawable.ic_launcher);
networkImageView=(NetworkImageView)findViewById(R.id.iVi_network_image);
networkImageView.setDefaultImageResId(R.drawable.ic_launcher);
networkImageView.setErrorImageResId(R.drawable.ic_launcher);
networkImageView.setImageUrl("https://raw.githubusercontent.com/GankLun/VolleyUtils/master/volley.jpg", VolleyUtil.getImageLoader(MainActivity.this));
}
示例11: onCreateView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_meme, container, false);
if (mTemplate != null && v != null) {
NetworkImageView image = (NetworkImageView) v.findViewById(R.id.meme_template_image);
image.setImageUrl(mTemplate.getUrl(), mVolley.getImageLoader());
image.setDefaultImageResId(R.drawable.ic_action_camera_wide);
image.setErrorImageResId(R.drawable.ic_action_camera_wide);
}
return v;
}
示例12: getChildView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String nome = getChild(groupPosition, childPosition).nome;
final String desc = getChild(groupPosition, childPosition).desc;
final String imageLink = getChild(groupPosition, childPosition).imageLink;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) getActivity()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_pessoa, null);
}
if (imageLoader == null)
imageLoader = AppController.getInstance().getImageLoader();
NetworkImageView thumbNail = (NetworkImageView) convertView
.findViewById(R.id.thumbnail);
thumbNail.setDefaultImageResId(R.drawable.loader);
thumbNail.setErrorImageResId(R.drawable.loader);
TextView eventoNome = (TextView)convertView.findViewById(R.id.textView1);
TextView eventoDesc = (TextView)convertView.findViewById(R.id.textView2);
eventoNome.setText(nome);
eventoDesc.setText(desc);
thumbNail.setImageUrl(imageLink, imageLoader);
return convertView;
}
示例13: onCreate
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
@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);
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:16,代码来源:NetworkImageViewActivity.java
示例14: onCreate
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的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);
}
示例15: setNetworkImageView
import com.android.volley.toolbox.NetworkImageView; //导入方法依赖的package包/类
private void setNetworkImageView(NetworkImageView networkImageView, String url) {
networkImageView.setDefaultImageResId(defaultImage);
networkImageView.setErrorImageResId(defaultImage);
networkImageView.setImageUrl(url,
MySingleton.getInstance(mContext.getApplicationContext()).getImageLoader());
}