Adapter getCount - 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 getCount method.

This code example shows how to use the following methods:getCount
  public AdapterWrapper(ListAdapter delegate) {
    this.delegate=delegate;
  } 
   
  public int getCount() { 
    return(delegate.getCount());
  } 
   
  public Object getItem(int position) {
    return(delegate.getItem(position));
  } 
   
  public long getItemId(int position) {
    return(delegate.getItemId(position));
  } 
   
  public View getView(int position, View convertView,
                      ViewGroup parent) {
    return(delegate.getView(position, convertView, parent));
  } 
7
CodeRank
This code example shows how to use the following methods:getCount
    private final List<DataSetObserver> dataSetObservers = new ArrayList<DataSetObserver>();
    private boolean wasNotifyDataSetChangedCalled;
 
    @Implementation 
    public boolean isEmpty() { 
    	return realBaseAdapter.getCount() == 0;
    } 
 
    /** 
     * Just returns true 
     * 
     * @return true 
     */ 
    @Implementation 
    public boolean areAllItemsEnabled() { 
        return true; 
    } 
 
    /** 
     * Registers the observer. 
7
CodeRank
This code example shows how to use the following methods:getCount
		wrapped.unregisterDataSetObserver(dataSetObserver);
	} 
 
	@Override 
	public int getCount() { 
		return wrapped.getCount();
	} 
 
	@Override 
	public Object getItem(int i) {
		return wrapped.getItem(i);
	} 
 
	@Override 
	public long getItemId(int i) {
		return wrapped.getItemId(i);
	} 
 
	@Override 
	public boolean hasStableIds() { 
6
CodeRank
This code example shows how to use the following methods:getCount, getView
        int preferredHeight = 0;
        int preferredWidth = 0;
        boolean needsMeasuring = true;
 
        int selectedPosition = getSelectedItemPosition();
        if (selectedPosition >= 0 && mAdapter != null && selectedPosition < mAdapter.getCount()) {
            // Try looking in the recycler. (Maybe we were measured once already) 
            View view = mRecycler.get(selectedPosition);
            if (view == null) {
                // Make a new one 
                view = mAdapter.getView(selectedPosition, null, this);
            } 
 
            if (view != null) {
                // Put in recycler for re-measuring and/or layout 
                mRecycler.put(selectedPosition, view);
            } 
 
            if (view != null) {
                if (view.getLayoutParams() == null) {
6
CodeRank
This code example shows how to use the following methods:getCount
        adapter.registerDataSetObserver(mDataSetObserver);
    } 
 
    @Override 
    public int getCount() { 
        return mDelegate.getCount();
    } 
 
    @Override 
    public Object getItem(int position) {
        return mDelegate.getItem(position);
    } 
 
    @Override 
    public long getItemId(int position) {
        return mDelegate.getItemId(position);
    } 
 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
6
CodeRank
This code example shows how to use the following methods:getCount
This code example shows how to use the following methods:getCount
    public void testPreconditions() {	 
        assertNotNull(mStatusView);
        assertNotNull(mAccountsSpinner);
 
        assertTrue(mAccountAdapter != null);
        assertEquals(mAccountAdapter.getCount(),1);
    } 
     
    public void testStatusRegisteredText() { 
    	status = mActivity.getString(sg.macbuntu.android.pushcontacts.R.string.status_registered);
        assertEquals(status,(String)mStatusView.getText());
    } 
     
    public void testStatusNotRegisteredText() { 
    	status = mActivity.getString(sg.macbuntu.android.pushcontacts.R.string.status_not_registered);
        assertEquals(status,(String)mStatusView.getText());
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getCount
        int prevHeightWithoutPartialChild = 0;
        int i;
        View child;
 
        // mItemCount - 1 since endPosition parameter is inclusive 
        endPosition = (endPosition == -1/*NO_POSITION*/) ? adapter.getCount() - 1 : endPosition;
 
        for (i = startPosition; i <= endPosition; ++i) {
            child = mAdapter.getView(i, null, mDropDownList);
            if (mDropDownList.getCacheColorHint() != 0) {
                child.setDrawingCacheBackgroundColor(mDropDownList.getCacheColorHint());
            } 
 
            measureScrapChild(child, i, widthMeasureSpec);
 
            if (i > 0) {
                // Count the divider for all but one child 
                returnedHeight += dividerHeight;
            } 
 
6
CodeRank
This code example shows how to use the following methods:getCount, registerDataSetObserver
                // adapter.  It is now time to show it. 
                setListShown(true, getView().getWindowToken() != null); 
            } 
        } 
        updateEmpty(); 
        mAdapter.registerDataSetObserver(new DataSetObserver() {
            @Override 
            public void onChanged() { 
                super.onChanged(); 
 
                updateEmpty(); 
            } 
 
            @Override 
            public void onInvalidated() { 
                super.onInvalidated(); 
 
                updateEmpty(); 
            } 
 

5
CodeRank
This code example shows how to use the following methods:getCount
 
        /* 
         *  Also ensure that the backing mLocalAdapter has the correct number of entries. 
         */ 
 
        assertEquals(mPlanetData.getCount(), ADAPTER_COUNT);
    } 
 
    /* 
     * Tests the UI of the main activity. Sends key events (keystrokes) to the UI, then checks 
     * if the resulting spinner state is consistent with the attempted selection. 
     */ 
    public void testSpinnerUI() { 
 
        /* 
         * Request focus for the spinner widget in the application under test, 
         * and set its initial position. This code interacts with the app's View 
         *  so it has to run on the app's thread not the test's thread. 
         * 
         * To do this, pass the necessary code to the application with 
6
CodeRank

Related Adapter getCount Questions & Answers:

getCount Method Overview
How many items are in the data set represented by this Adapter.
See Code Examples for other Android Adapter Methods: