Code example for ArrayAdapter

Methods: clear

0
        } 
        return super.onMenuItemSelected( featureId, item );
    } 
 
    public void onClear( View v ) {
        arrayAdapter.clear();
    } 
 
    private List< String > initListItem() {
        List< String > result = new ArrayList< String >();
        for ( int index = 0; index < ITEM_COUNT; index++ ) {
            result.add( "Item " + index );
        } 
        return result;
    } 
 
    private void refreshList() { 
        List< String > listItems = initListItem();
        arrayAdapter = new ArrayAdapter< String >( this, android.R.layout.simple_list_item_1, listItems );
        listMain.setAdapter( arrayAdapter );
        new Handler().postDelayed( new Runnable() {