Adapter getItemViewType - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Adapter getItemViewType method.

This code example shows how to use the following methods:getItemViewType
  public int getViewTypeCount() { 
    return(delegate.getViewTypeCount());
  } 
   
  public int getItemViewType(int position) {
    return(delegate.getItemViewType(position));
  } 
   
  public void unregisterDataSetObserver(DataSetObserver observer) {
    delegate.unregisterDataSetObserver(observer);
  } 
   
  public boolean areAllItemsEnabled() { 
    return(delegate.areAllItemsEnabled());
  } 
   
  public boolean isEnabled(int position) {
    return(delegate.isEnabled(position));
  } 
} 
7
CodeRank
This code example shows how to use the following methods:getItemViewType
		return wrapped.getView(position, view, viewGroup);
	} 
 
	@Override 
	public int getItemViewType(int i) {
		return wrapped.getItemViewType(i);
	} 
 
	@Override 
	public int getViewTypeCount() { 
		return wrapped.getViewTypeCount();
	} 
 
	@Override 
	public boolean isEmpty() { 
		return wrapped.isEmpty();
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getCount, getItemViewType
	protected int loadingViewType() { 
		return (baseAdapter.getViewTypeCount() - 1) + 2;
	}	 
	 
	public int getItemViewType(int position) {
		if (position < baseAdapter.getCount()) {
			return baseAdapter.getItemViewType(position);
		} else { 
			if (isLoadingMore) return loadingViewType();
			return loadMoreViewType(); 
		} 
	} 
	 
	public View getLoadMoreView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView =  ((Activity)context).getLayoutInflater().inflate(R.layout.load_more_item, null);
        } 
        return convertView;		
	} 
	 
5
CodeRank
This code example shows how to use the following methods:getCount, getItemViewType
    } 
 
    /** {@inheritDoc} */ 
    public int getItemViewType(int position) {
        if (isItem(position)) {
            return mAdapter.getItemViewType(position);
        } else { 
            return AdapterView.ITEM_VIEW_TYPE_IGNORE;
        } 
    } 
 
    /** {@inheritDoc} */ 
    public int getViewTypeCount() { 
        return mAdapter.getViewTypeCount();
    } 
 
    private boolean isItem(int position) {
        return position < mAdapter.getCount();
    } 
 

5
CodeRank
This code example shows how to use the following methods:getItemViewType
 
	public int getItemViewType(int position) {
		if (position == 0)
			return 0; 
		else 
			return 1+this.contentAdapter.getItemViewType(position-1);
	} 
 
	public View getView(int position, View convertView, ViewGroup parent) {
		if (position == 0)
			return this.titleView;
		else 
			return this.contentAdapter.getView(position-1, convertView, parent);
	} 
 
	public int getViewTypeCount() { 
		return 1+this.contentAdapter.getViewTypeCount();
	} 
 
	public boolean hasStableIds() { 
4
CodeRank
This code example shows how to use the following methods:getCount, getItemViewType
    } 
 
    /** {@inheritDoc} */ 
    public int getItemViewType(int position) {
        if (isItem(position)) {
            return mAdapter.getItemViewType(position);
        } else { 
            return AdapterView.ITEM_VIEW_TYPE_IGNORE;
        } 
    } 
 
    /** {@inheritDoc} */ 
    public int getViewTypeCount() { 
        return mAdapter.getViewTypeCount();
    } 
 
    private boolean isItem(int position) {
        return position < mAdapter.getCount();
    } 
 

5
CodeRank
This code example shows how to use the following methods:getItemViewType
        return delegate.getItemId(i);
    } 
 
    @Override 
    public int getItemViewType(int i) {
        return delegate.getItemViewType(i);
    } 
 
    @Override 
    public View getView(int i, View view, ViewGroup viewGroup) {
        ++vpsViewCount;
        Log.d("VpsAdapter", String.format("VpsAdapter: %.2f views per second (%s views)", getViewsPerSecond(), getViewsPerSecondViewCount()));
        return delegate.getView(i, view, viewGroup);
    } 
 
    @Override 
    public int getViewTypeCount() { 
        return delegate.getViewTypeCount();
    } 
 
4
CodeRank
This code example shows how to use the following methods:getItemViewType
            return wrapped.getItemId(position);
        } 
 
        @Override 
        public int getItemViewType(int position) {
            return wrapped.getItemViewType(position);
        } 
 
        @Override 
        public View getView(int position, View convertView, ViewGroup parent) {
            return onPrepareView(wrapped.getView(position, convertView, parent), position);
        } 
 
        @Override 
        public int getViewTypeCount() { 
            return wrapped.getViewTypeCount();
        } 
 
        @Override 
        public boolean hasStableIds() { 
3
CodeRank
This code example shows how to use the following methods:getCount, getItemViewType
            return HEADER_TYPE;
        } 
 
        if (mAdapter != null && position >= headerSize) {
            int adjPosition = position - headerSize;
            int adapterCount = mAdapter.getCount();
            if (adjPosition < adapterCount) {
                return mAdapter.getItemViewType(adjPosition) + REFRESHABLE_LIST_TYPE;
            } 
        } 
 
        return FOOTER_TYPE;
    } 
 
    @Override 
    public int getViewTypeCount() { 
        if (mAdapter != null) {
            return mAdapter.getViewTypeCount() + TYPE_COUNT_WITHOUT_REFRESHABLE_LIST;
        } 
        return 1; 
4
CodeRank
This code example shows how to use the following methods:getItemViewType
        return delegate.getItemId(position);
    } 
 
    @Override 
    public int getItemViewType(int position) {
        return delegate.getItemViewType(position);
    } 
 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
        return delegate.getView(position, convertView, parent);
    } 
 
    @Override 
    public int getViewTypeCount() { 
        return delegate.getViewTypeCount();
    } 
 
    @Override 
    public boolean hasStableIds() { 
4
CodeRank

Related Adapter getItemViewType Questions & Answers:

getItemViewType Method Overview
Get the type of View that will be created by getView(int, View, ViewGroup) for the specified item.
See Code Examples for other Android Adapter Methods: