Search in sources :

Example 41 with SimpleAdapter

use of android.widget.SimpleAdapter in project android-betterpickers by code-troopers.

the class ListSamples method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list);
    Intent intent = getIntent();
    String path = intent.getStringExtra(INTENT_PATH);
    if (path == null) {
        path = "";
    } else {
        getSupportActionBar().setTitle(path);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    final ListView list = (ListView) findViewById(R.id.list);
    list.setAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
    list.setTextFilterEnabled(true);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Map<String, Object> map = (Map<String, Object>) list.getItemAtPosition(position);
            Intent intent = (Intent) map.get("intent");
            startActivity(intent);
        }
    });
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) HashMap(java.util.HashMap) Map(java.util.Map)

Example 42 with SimpleAdapter

use of android.widget.SimpleAdapter in project android-app by eoecn.

the class DetailsDiscussActivity method initList.

private void initList() {
    mlist = new ArrayList<Map<String, Object>>();
    mAdapter = new SimpleAdapter(this, mlist, R.layout.details_discuss_item, new String[] { "image", "name", "content", "time" }, new int[] { R.id.details_imageview_head, R.id.details_textview_name, R.id.details_textview_content, R.id.details_textview_time }) {

        @Override
        public void setViewImage(ImageView v, String value) {
            // TODO Auto-generated method stub
            super.setViewImage(v, value);
            ImageUtil.setThumbnailView(value, v, DetailsDiscussActivity.this, callback, false);
        }

        ImageCallback callback = new ImageCallback() {

            @Override
            public void loadImage(Bitmap bitmap, String imagePath) {
                // TODO Auto-generated method stub
                try {
                    ImageView img = (ImageView) mListview.findViewWithTag(imagePath);
                    img.setImageBitmap(bitmap);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
    };
    mListview.setAdapter(mAdapter);
}
Also used : Bitmap(android.graphics.Bitmap) SimpleAdapter(android.widget.SimpleAdapter) ImageCallback(cn.eoe.app.utils.ImageUtil.ImageCallback) ImageView(android.widget.ImageView) HashMap(java.util.HashMap) Map(java.util.Map) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 43 with SimpleAdapter

use of android.widget.SimpleAdapter in project UltimateAndroid by cymcsg.

the class ObservableScrollViewActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.observable_scroll_view_activity_main);
    ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(new SimpleAdapter(this, getData(), R.layout.observable_scroll_view_list_item_main, new String[] { TAG_CLASS_NAME, TAG_DESCRIPTION }, new int[] { R.id.className, R.id.description }));
    listView.setOnItemClickListener(this);
}
Also used : ListView(android.widget.ListView) SimpleAdapter(android.widget.SimpleAdapter)

Example 44 with SimpleAdapter

use of android.widget.SimpleAdapter in project TextJustify-Android by bluejamesbond.

the class ListViewTest method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>();
    data.add(new HashMap<String, Object>() {

        {
            put("Title", "Item 1");
        }
    });
    data.add(new HashMap<String, Object>() {

        {
            put("Title", "Item 2");
        }
    });
    data.add(new HashMap<String, Object>() {

        {
            put("Title", "Item 3");
        }
    });
    final ListView listview = (ListView) findViewById(R.id.list);
    SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.test_listview_item, new String[] { "Title" }, new int[] { R.id.title });
    listview.setAdapter(adapter);
}
Also used : ListView(android.widget.ListView) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SimpleAdapter(android.widget.SimpleAdapter)

Example 45 with SimpleAdapter

use of android.widget.SimpleAdapter in project Signal-Android by WhisperSystems.

the class CountrySelectionFragment method onLoadFinished.

@Override
public void onLoadFinished(Loader<ArrayList<Map<String, String>>> loader, ArrayList<Map<String, String>> results) {
    String[] from = { "country_name", "country_code" };
    int[] to = { R.id.country_name, R.id.country_code };
    this.setListAdapter(new SimpleAdapter(getActivity(), results, R.layout.country_list_item, from, to));
    if (this.countryFilter != null && this.countryFilter.getText().length() != 0) {
        ((SimpleAdapter) getListAdapter()).getFilter().filter(this.countryFilter.getText().toString());
    }
}
Also used : SimpleAdapter(android.widget.SimpleAdapter)

Aggregations

SimpleAdapter (android.widget.SimpleAdapter)72 Intent (android.content.Intent)29 ListView (android.widget.ListView)18 HashMap (java.util.HashMap)15 View (android.view.View)12 AdapterView (android.widget.AdapterView)12 Map (java.util.Map)9 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 FragmentManager (android.support.v4.app.FragmentManager)4 ListFragment (android.support.v4.app.ListFragment)4 OnClickListener (android.view.View.OnClickListener)4 ArrayList (java.util.ArrayList)4 Context (android.content.Context)3 ViewGroup (android.view.ViewGroup)3 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)3 ListAdapter (android.widget.ListAdapter)3 SharedPreferences (android.content.SharedPreferences)2 AssetManager (android.content.res.AssetManager)2 SQLException (android.database.SQLException)2