Android BaseAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android BaseAdapter class.

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:notifyDataSetChanged
        info.view = view;
        info.data = data;
        info.isSelectable = isSelectable;
 
        headers.add(info);
        wrapped.notifyDataSetChanged();
        return this;
    } 
 
    /** 
     * Add non-selectable footer view with no data 
     * 
     * @see #addFooter(View, Object, boolean) 
     * @param view 
     * @return this adapter 
     */ 
    public HeaderFooterListAdapter<E> addFooter(View view) {
        return addFooter(view, null, false);
    } 
 
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:notifyDataSetChanged
            ((FavoritesListAdapter) mAdapter).fillWithItems(mFeedItems);
        } else { 
            mAdapter = new FeedItemsListAdapter(getBaseActivity());
            ((FeedItemsListAdapter) mAdapter).fillWithItems(mFeedItems);
        } 
        mAdapter.notifyDataSetChanged();
 
        setListAdapter(mAdapter);
    } 
 
    @Override 
    public void onLoaderReset(Loader<List<FeedItem>> listLoader) {
        mFeedItems.clear();
    } 
} 
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
    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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
        info.view = view;
        info.data = data;
        info.isSelectable = isSelectable;
 
        headers.add(info);
        wrapped.notifyDataSetChanged();
        return this;
    } 
 
    /** 
     * Add non-selectable footer view with no data 
     * 
     * @see #addFooter(View, Object, boolean) 
     * @param view 
     * @return this adapter 
     */ 
    public HeaderFooterListAdapter<E> addFooter(View view) {
        return addFooter(view, null, false);
    } 
 
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:unregisterDataSetObserver, swapCursor
this.headers.add(section);
		SimpleCursorAdapter prev = this.sections.put(section, adapter);
		if (prev != null) {
			Log.d("listproto", "killing previous adapter");
			prev.unregisterDataSetObserver(subObserver);
			prev.swapCursor(null);
		} 
		if (adapter != null) {
			adapter.registerDataSetObserver(subObserver);
		} 
		// Need to sort the headers each time it changes 
		if (comp != null) {
			headers.sort(comp);
		} 
	} 
 
	public void removeSection(String section, Comparator<String> comp) {
		if (headers == null) {
			throw new InvalidParameterException(ERRORMSG);
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:notifyDataSetChanged
        this.adapter = adapter;
    } 
 
    @Override 
    public void onSuccess() { 
        adapter.notifyDataSetChanged();
    } 
} 
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:notifyDataSetChanged
        selection.remove(handle);
        if (getSelectionCount() == 0) { 
            finishActionMode(); 
            return; 
        } 
        owner.notifyDataSetChanged();
        onItemSelectedStateChanged(); 
    } 
 
    Set<Long> getSelection() {
        // Return a copy to prevent concurrent modification problems 
        return new HashSet<Long>(selection);
    } 
 
    int getSelectionCount() { 
        return selection.size();
    } 
 
    boolean isSelected(long handle) {
        return selection.contains(handle);
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
        Toast.makeText(getContext(), toastText, Toast.LENGTH_SHORT).show();
    } 
 
    private void removeContent() { 
        mHistory.remove(mHistoryEntry);
        mAdapter.notifyDataSetChanged();
    } 
 
    public HistoryEntry getHistoryEntry() { 
        return mHistoryEntry;
    } 
 
    public void setHistoryEntry(HistoryEntry historyEntry) {
        this.mHistoryEntry = historyEntry;
    } 
 
    public History getHistory() { 
        return mHistory;
    } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
        info.view = view;
        info.data = data;
        info.isSelectable = isSelectable;
 
        headers.add(info);
        wrapped.notifyDataSetChanged();
        return this;
    } 
 
    /** 
     * Add non-selectable footer view with no data 
     * 
     * @see #addFooter(View, Object, boolean) 
     * @param view 
     * @return this adapter 
     */ 
    public HeaderFooterListAdapter<E> addFooter(View view) {
        return addFooter(view, null, false);
    } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android BaseAdapter Questions & Answers:

Other Android BaseAdapter Examples

7:	import android.widget.ImageView;
8:	
9:	public class ImageAdapter extends BaseAdapter {
10:		private Context mContext;
11:

Read More

11:	
12:	public class ListViewAdapter extends BaseAdapter {
13:	
14:	    private Activity activity;
15:	    private ArrayList<HashMap<String, String>> data;

Read More

14:	import android.widget.TextView;
15:	
16:	public class NavDrawerListAdapter extends BaseAdapter {
17:		
18:		private Context context;

Read More

1:	public class ImageAdapter extends BaseAdapter {
2:	    private Context mContext;
3:

Read More

See Code Examples for Android BaseAdapter Methods: