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

This code example shows how to use the following methods:getCount, getItem, isEmpty
 
import jp.mixi.compatibility.android.widget.ArrayAdapterCompat; 
 
public class ArrayAdapterCompatTest extends AndroidTestCase {
    public void testAddAllCollection() { 
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.id.text1);
        List<String> list = new ArrayList<String>();
        list.add("test1");
        list.add("test2");
        list.add("test3");
        ArrayAdapterCompat.addAll(adapter, list);
        assertFalse(adapter.isEmpty());
        assertEquals(3, adapter.getCount());
        assertEquals("test1", adapter.getItem(0));
        assertEquals("test2", adapter.getItem(1));
        assertEquals("test3", adapter.getItem(2));
    } 
 
    public void testAddAllArray() { 
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.id.text1);
        String[] array = new String[] {"test1", "test2", "test3"};
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:add, getCount
					BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); 
				} 
			} else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)) { 
				BluetoothListDevicesActivity.this.setProgressBarIndeterminateVisibility(false); 
				BluetoothListDevicesActivity.this.setTitle("Select a device to connect..."); 
				if (BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.getCount() == 0) { 
					BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.add("No devices found!"); 
				} 
			} 
		} 
	}; 
 
 
	// =========================================================== 
	// Constructors 
	// =========================================================== 
 
	@Override 
	protected void onCreate(final Bundle pSavedInstanceState) {
		super.onCreate(pSavedInstanceState);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCount
		} 
    } 
     
    @Override 
    public boolean performClick() { 
    	if (adapter.getCount() > 0) showDropDown();
    	return super.performClick(); 
    } 
     
    public String getHistoryString() {
    	StringBuilder string = new StringBuilder();
		for(int i=0; i < adapter.getCount(); i++) {
            string.append(adapter.getItem(i));
            string.append("\n");
        } 
    	return string.toString();
    } 
 
	public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
		if (actionId == EditorInfo.IME_NULL) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCount
        return adapter.getItem(index); 
    } 
 
    @Override 
    public int size() { 
        return adapter.getCount(); 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related ArrayAdapter getCount Questions & Answers:

getCount Method Overview
See Code Examples for other Android ArrayAdapter Methods: