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


Java NetworkImageView.setErrorImageResId方法代碼示例

本文整理匯總了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);

}
 
開發者ID:datafile4,項目名稱:book-store-android,代碼行數:18,代碼來源:CartAdapter.java

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

}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:24,代碼來源:AddQuickPressShortcutActivity.java

示例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;
}
 
開發者ID:blynch,項目名稱:CloudMemeAndroid,代碼行數:25,代碼來源:MemeAdapter.java

示例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;
}
 
開發者ID:blynch,項目名稱:CloudMemeAndroid,代碼行數:20,代碼來源:MemeTemplateAdapter.java

示例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;
  }
 
開發者ID:carloscorreia94,項目名稱:AEISTMobileDROID,代碼行數:26,代碼來源:EventoExpAdapter.java

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

		}
	};
}
 
開發者ID:ruiyuLee,項目名稱:UnionListView,代碼行數:23,代碼來源:TwoUnionView.java

示例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); 
}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:8,代碼來源:NetworkImageViewAdapter.java

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

}
 
開發者ID:datafile4,項目名稱:book-store-android,代碼行數:16,代碼來源:BookAdapter.java

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

}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:34,代碼來源:MediaGridAdapter.java

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

示例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;
}
 
開發者ID:blynch,項目名稱:CloudMemeAndroid,代碼行數:13,代碼來源:MemeTemplateFragment.java

示例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;
  }
 
開發者ID:carloscorreia94,項目名稱:AEISTMobileDROID,代碼行數:30,代碼來源:FiscalFrag.java

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

}
 
開發者ID:nico-gonzalez,項目名稱:volley-it,代碼行數:59,代碼來源:MainActivity.java

示例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());
}
 
開發者ID:freedomofme,項目名稱:Netease,代碼行數:7,代碼來源:HorizontalImageRecyclerViewAdapter.java


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