Android SimpleAdapter - 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 SimpleAdapter class.

This code example shows how to use the following methods:
 
        if (path == null) {
            path = "";
        } 
 
        setListAdapter(new SimpleAdapter(this, getData(path),
                android.R.layout.simple_list_item_1, new String[] { "title" },
                new int[] { android.R.id.text1 }));
        getListView().setTextFilterEnabled(true); 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
        SubMenu sub = menu.addSubMenu("Theme");
        sub.add(0, R.style.Theme_Sherlock, 0, "Default");
        sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
        sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
        sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
        return true; 
    } 
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:
 
        if (path == null) {
            path = "";
        } 
 
        setListAdapter(new SimpleAdapter(this, getData(path),
                android.R.layout.simple_list_item_1, new String[] { "title" },
                new int[] { android.R.id.text1 }));
        getListView().setTextFilterEnabled(true); 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
        SubMenu sub = menu.addSubMenu("Theme");
        sub.add(0, R.style.Theme_Sherlock, 0, "Default");
        sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
        sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
        sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
        return true; 
    } 
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:setAdapter
			jmdns.addServiceListener("_mpd._tcp.local.", this);
		} catch (IOException e) {
			//Do nothing, stuff will just not work 
		} 
			 
		listAdapter = new SimpleAdapter(this, servers, android.R.layout.simple_list_item_1, new String[]{SERVER_NAME}, new int[]{android.R.id.text1});
		getListView().setAdapter(listAdapter);
    } 
     
    @Override 
    protected void onPause() { 
    	if(multicastLock == null || jmdns == null) {
    		super.onPause(); 
    		return; 
    	} 
    	multicastLock.release();
    	 
    	super.onPause(); 
    } 
     
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:
public class MainActivity extends ListActivity {
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setListAdapter(
			new SimpleAdapter(
				this, getData(), android.R.layout.simple_list_item_1, new String[]{"title"}, new int[]{android.R.id.text1}
			) 
		); 
		getListView().setScrollbarFadingEnabled(false);
	} 
	 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true; 
	} 
 
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
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:
 
        if (path == null) {
            path = "";
        } 
 
        setListAdapter(new SimpleAdapter(this, getData(path),
                android.R.layout.simple_list_item_1, new String[] { "title" },
                new int[] { android.R.id.text1 }));
        getListView().setTextFilterEnabled(true); 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
        SubMenu sub = menu.addSubMenu("Theme");
        sub.add(0, R.style.Theme_Sherlock, 0, "Default");
        sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
        sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
        sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
        return true; 
    } 
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:
 
        setListAdapter(new SimpleAdapter(this,
                getData(), 
                android.R.layout.simple_list_item_1,
                new String[] {"title"},
                new int[] {android.R.id.text1}));
    } 
     
    protected List getData()
    { 
        List myData = new ArrayList<Bundle>(7);
        addItem(myData, "Sans",                 "sans-serif",   Typeface.NORMAL);
        addItem(myData, "Sans Bold",            "sans-serif",   Typeface.BOLD);
        addItem(myData, "Serif",                "serif",        Typeface.NORMAL);
        addItem(myData, "Serif Bold",           "serif",        Typeface.BOLD);
        addItem(myData, "Serif Italic",         "serif",        Typeface.ITALIC);
        addItem(myData, "Serif Bold Italic",    "serif",        Typeface.BOLD_ITALIC);
        addItem(myData, "Mono",                 "monospace",    Typeface.NORMAL);
        return myData;
    } 
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:
		super.onCreate(savedInstanceState);
		ArrayList<Map<String, String>> list = buildData();
		String[] from = { "name", "purpose" };
		int[] to = { android.R.id.text1, android.R.id.text2 };
 
		SimpleAdapter adapter = new SimpleAdapter(this, list,
				android.R.layout.simple_list_item_2, from, to);
		setListAdapter(adapter);
	} 
 
	private ArrayList<Map<String, String>> buildData() {
		ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>();
		list.add(putData("Android", "Mobile"));
		list.add(putData("Windows7", "Windows7"));
		list.add(putData("iPhone", "iPhone"));
		return list;
	} 
 
	private HashMap<String, String> putData(String name, String purpose) {
		HashMap<String, String> item = new HashMap<String, String>();
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:
 
        setListAdapter(new SimpleAdapter(this,
                getData(), 
                android.R.layout.simple_list_item_1,
                new String[] {"title"},
                new int[] {android.R.id.text1}));
    } 
     
    protected List getData()
    { 
        List myData = new ArrayList<Bundle>();
        addItem(myData, "Solid White", 0, 0xFFFFFFFF, 0xFF000000);
        addItem(myData, "Solid Light Gray", 0, 0xFFBFBFBF, 0xFF000000);
        addItem(myData, "Solid Dark Gray", 0, 0xFF404040, 0xFFFFFFFF);
        addItem(myData, "Solid Black", 0, 0xFF000000, 0xFFFFFFFF);
        addItem(myData, "Solid Blue", 0, 0xFF1a387a, 0xFFFFFFFF);
        addItem(myData, "Textured White", 0, 0, 0xFF000000);
        // addItem(myData, "Textured Blue", android.R.drawable.screen_background_blue, 0, 0xFFFFFFFF); 
 
        return myData;
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:
         * @see #doInBackground 
         */ 
        @Override 
        protected void onPostExecute(List<Map<String, String>> items) {
            setProgressBarIndeterminateVisibility(false);
            ListAdapter adapter = new SimpleAdapter(mActivity, items,
                    android.R.layout.simple_list_item_2, new String[]{KEY_TITLE, KEY_TEXT},
                    new int[]{android.R.id.text1, android.R.id.text2});
 
            // Bind to our new adapter. 
            setListAdapter(adapter);
        } 
    } 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        mActivity = this;
        mContentResolver = getContentResolver();
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:
		result.add(createElement("Local load", "In this example, you provide list of files  to display in gallery"));
		return result;
	} 
	public ListAdapter createAdapter() 
	{ 
		SimpleAdapter adapter = new SimpleAdapter(this, getData(), 
				android.R.layout.simple_list_item_2, 
				new String[]{TITLE, SUBTITLE}, 
				new int[]{android.R.id.text1, android.R.id.text2});
		return adapter;
	} 
 
	@Override 
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent i = null;
		switch (position) 
		{ 
		case 0: 
			i = new Intent(this, GalleryUrlActivity.class);
			break; 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android SimpleAdapter Questions & Answers:

Other Android SimpleAdapter Examples

36:			}
37:	
38:			// Adding menuItems to ListView
39:			ListAdapter adapter = new SimpleAdapter(this, songsListData,
40:					R.layout.playlist_item, new String[] { "songTitle" }, new int[] {

Read More

78:						e.printStackTrace();
79:					}
80:				} else {
81:					Log.e("ServiceHandler", "Couldn't get any data from the url");
82:				}

Read More

35:				menuItems.add(map);
36:			}
37:	
38:			// Adding menuItems to ListView
39:			ListAdapter adapter = new SimpleAdapter(this, menuItems,

Read More

See Code Examples for Android SimpleAdapter Methods: