Search in sources :

Example 86 with SimpleAdapter

use of android.widget.SimpleAdapter in project android_frameworks_base by crdroidandroid.

the class VectorDrawableTest method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra("com.android.test.hwui.Path");
    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);
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Example 87 with SimpleAdapter

use of android.widget.SimpleAdapter in project android_packages_apps_Settings by LineageOS.

the class ZonePicker method constructTimezoneAdapter.

/**
 * Constructs an adapter with TimeZone list. Sorted by TimeZone in default.
 *
 * @param sortedByName use Name for sorting the list.
 */
public static SimpleAdapter constructTimezoneAdapter(Context context, boolean sortedByName, int layoutId) {
    final String[] from = new String[] { ZoneGetter.KEY_DISPLAY_LABEL, ZoneGetter.KEY_OFFSET_LABEL };
    final int[] to = new int[] { android.R.id.text1, android.R.id.text2 };
    final String sortKey = (sortedByName ? ZoneGetter.KEY_DISPLAY_LABEL : ZoneGetter.KEY_OFFSET);
    final MyComparator comparator = new MyComparator(sortKey);
    final List<Map<String, Object>> sortedList = ZoneGetter.getZonesList(context);
    Collections.sort(sortedList, comparator);
    final SimpleAdapter adapter = new SimpleAdapter(context, sortedList, layoutId, from, to);
    adapter.setViewBinder(new TimeZoneViewBinder());
    return adapter;
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) HashMap(java.util.HashMap) Map(java.util.Map)

Example 88 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class HwTests method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra("com.android.test.hwui.Path");
    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);
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Example 89 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ListView lv = (ListView) findViewById(android.R.id.list);
    lv.setDrawSelectorOnTop(true);
    lv.setAdapter(new SimpleAdapter(this, SAMPLES, R.layout.item_layout, new String[] { KEY_NAME }, new int[] { android.R.id.text1 }));
    lv.setOnItemClickListener(this);
    getActionBar().setTitle("MainActivity");
}
Also used : ListView(android.widget.ListView) SimpleAdapter(android.widget.SimpleAdapter)

Example 90 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra(EXTRA_PATH);
    if (path == null) {
        path = "";
    } else {
        // not root level, display where we are in the hierarchy
        setTitle(path);
    }
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentById(android.R.id.content) == null) {
        ListFragment listFragment = new TestListFragment();
        listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
        fm.beginTransaction().add(android.R.id.content, listFragment).commit();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ListFragment(android.support.v4.app.ListFragment) SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Aggregations

SimpleAdapter (android.widget.SimpleAdapter)133 HashMap (java.util.HashMap)52 ListView (android.widget.ListView)38 Intent (android.content.Intent)34 Map (java.util.Map)33 View (android.view.View)28 ArrayList (java.util.ArrayList)28 AdapterView (android.widget.AdapterView)27 TextView (android.widget.TextView)26 ViewGroup (android.view.ViewGroup)13 ListAdapter (android.widget.ListAdapter)10 ImageView (android.widget.ImageView)8 Spanned (android.text.Spanned)6 TtsSpan (android.text.style.TtsSpan)6 FrameLayout (android.widget.FrameLayout)6 Test (org.junit.Test)6 SuppressLint (android.annotation.SuppressLint)5 Context (android.content.Context)5 MotionEvent (android.view.MotionEvent)5 OnClickListener (android.view.View.OnClickListener)5