List of usage examples for android.widget SimpleAdapter SimpleAdapter
public SimpleAdapter(Context context, List<? extends Map<String, ?>> data, @LayoutRes int resource, String[] from, @IdRes int[] to)
From source file:net.reichholf.dreamdroid.fragment.ServiceEpgListFragment.java
/** * Initializes the <code>SimpleListAdapter</code> *//*from w w w . jav a 2 s.c o m*/ private void setAdapter() { mAdapter = new SimpleAdapter(getActionBarActivity(), mMapList, R.layout.epg_list_item, new String[] { Event.KEY_EVENT_TITLE, Event.KEY_EVENT_DESCRIPTION_EXTENDED, Event.KEY_EVENT_START_READABLE, Event.KEY_EVENT_DURATION_READABLE }, new int[] { R.id.event_title, R.id.event_short, R.id.event_start, R.id.event_duration }); setListAdapter(mAdapter); }
From source file:net.reichholf.dreamdroid.DreamDroidTest.java
/** Called when the activity is first created. */ @Override//from w w w .j a va 2 s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMapList = new ArrayList<ExtendedHashMap>(); ExtendedHashMap map = new ExtendedHashMap(); map.put("item", "Timer"); map.put("desc", "Show, Add and edit Timers"); mMapList.add(map.clone()); map.clear(); map.put("item", "Movies"); map.put("desc", "A list of recorded Movies"); mMapList.add(map.clone()); mAdapter = new SimpleAdapter(this, mMapList, android.R.layout.two_line_list_item, new String[] { "item", "desc" }, new int[] { R.id.text1, R.id.text2 }); setListAdapter(mAdapter); // httpTest(); Intent intent = new Intent(this, MovieListActivity.class); this.startActivity(intent); intent = new Intent(this, TimerListActivity.class); this.startActivity(intent); }
From source file:com.savvywits.wethepeople.RESTResultFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new SimpleAdapter(getActivity(), mReplist, R.layout.results_item, new String[] { "name", "party", "state", "district", "address", "phone", "link" }, new int[] { R.id.name, R.id.party, R.id.state, R.id.district, R.id.address, R.id.phone, R.id.link }); }
From source file:me.chenjiayang.myleancloud.CarInfoActivity.java
public void setAdapter() { mListView = (ListView) this.findViewById(R.id.listview); //??SimpleAdapter simpleAdapter = new SimpleAdapter(this, item, R.layout.activity_car_info, new String[] { "itemTitle", "itemTag", "itemPhoto", "itemSummary" }, new int[] { R.id.title, R.id.ifNowDrivingTag, R.id.photograph, R.id.summary }); //SimpleAdapterListView mListView.setAdapter(simpleAdapter); }
From source file:uk.org.tomek.rssreader.activity.FeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.feed_list);/*from w w w . j a v a 2 s .com*/ final List<FeedItem> feedsList = getIntent().getParcelableArrayListExtra(Configuration.TAG_ITEMS_ARRAY); // create ArrayList of Maps for SimpleAdapter List<Map<String, String>> rssItemsList = getArrayListOfItemMaps(feedsList); // Create ListView ListView itemsListView = (ListView) findViewById(R.id.feed_list); // TextView elements in feed_item int[] toViews = { R.id.artist, R.id.title }; SimpleAdapter adapter = new SimpleAdapter(this, rssItemsList, R.layout.feed_item, new String[] { "artist", "title" }, toViews); // Set list adapter for the ListView itemsListView.setAdapter(adapter); // set clicks listener itemsListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int pos, long id) { Intent intent = new Intent(FeedActivity.this, FeedWebActivity.class); intent.putExtra(Configuration.LINK_TAG, feedsList.get(pos).getLink()); startActivity(intent); } }); }
From source file:com.owncloud.android.extensions.ExtensionsListActivity.java
public void done(JSONArray a) { LinkedList<HashMap<String, String>> ll = new LinkedList<HashMap<String, String>>(); for (int i = 0; i < a.length(); ++i) { try {//from w ww .j a v a 2 s.c o m ExtensionApplicationEntry ela = new ExtensionApplicationEntry(((JSONObject) a.get(i))); HashMap<String, String> ss = new HashMap<String, String>(); ss.put("NAME", ela.getName()); ss.put("DESC", ela.getDescription()); ll.add(ss); } catch (JSONException e) { e.printStackTrace(); } } setListAdapter(new SimpleAdapter(this, ll, R.layout.simple_list_item_2, new String[] { "NAME", "DESC" }, new int[] { android.R.id.text1, android.R.id.text2 })); }
From source file:com.marcosedo.lagramola.HelpFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.help, container, false); //////////LISTVIEW, ADAPTER Y TEXTO DE LOS MENUS final Resources resources = getResources(); listView = (ListView) view.findViewById(android.R.id.list); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); String[] titles_str = { resources.getString(R.string.appVersionTxt), resources.getString(R.string.feedbackMail), resources.getString(R.string.OSLicenses) }; String[] subtitles_str = { resources.getString(R.string.appVersionNumber), resources.getString(R.string.myEmailAddress), "" }; for (int i = 0; i < titles_str.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); datum.put("title", titles_str[i]); datum.put("subtitle", subtitles_str[i]); data.add(datum);/* w ww . j a va2s. c o m*/ } SimpleAdapter adapter = new SimpleAdapter(getActivity(), data, android.R.layout.simple_list_item_2, new String[] { "title", "subtitle" }, new int[] { android.R.id.text1, android.R.id.text2 }); listView.setAdapter(adapter); //LISTENER DEL LIST VIEW esto nos saca el context menu con un solo click listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View v, int position, long arg3) { Resources resource = getActivity().getResources(); switch (position) { case 1: Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", Constantes.MY_EMAIL, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Body"); startActivity(Intent.createChooser(emailIntent, "Enviar email...")); break; case 2: String LicenseInfo = resource.getString(R.string.headerOSLicenses) + GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(getActivity()); LicenseDialog.setTitle(resource.getString(R.string.OSLicenses)); if (LicenseInfo != null) { LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); break; } } } }); return view; }
From source file:com.loadsensing.app.SensorsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sensor_list_view); // Get Intent parameters String XarxaSelected = ""; Bundle extras = null;// w w w .ja va 2s .c o m if (savedInstanceState == null) { extras = getIntent().getExtras(); if (extras == null) { XarxaSelected = null; } else { XarxaSelected = extras.getString("idxarxaselected"); } } else { XarxaSelected = (String) savedInstanceState.getSerializable("XarxaSelected"); } // adapter que mapeja la informaci del sensor amb els camps del layout SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.sensor_row_list_view, new String[] { "id", "sensor", "tipus", "descripcio", "poblacio", "canal" }, new int[] { R.id.text1, R.id.text2, R.id.text3, R.id.text4, R.id.text5, R.id.text6 }); SharedPreferences settings = getSharedPreferences("LoadSensingApp", Context.MODE_PRIVATE); String address = SERVER_HOST + "?IdXarxa=" + XarxaSelected + "&session=" + settings.getString("session", ""); Log.d(DEB_TAG, "Requesting to " + address); try { String jsonString = JsonClient.connectString(address); // Convertim la resposta string a un JSONArray JSONArray llistaSensorsArray = new JSONArray(jsonString); for (int i = 0; i < llistaSensorsArray.length(); i++) { JSONObject xarxaJSON = llistaSensorsArray.getJSONObject(i); sensors = new HashMap<String, String>(); sensors.put("id", xarxaJSON.getString("id")); sensors.put("sensor", xarxaJSON.getString("sensor")); sensors.put("canal", xarxaJSON.getString("canal")); sensors.put("tipus", xarxaJSON.getString("tipus")); sensors.put("descripcio", xarxaJSON.getString("Descripcio")); sensors.put("poblacio", xarxaJSON.getString("Poblacio")); list.add(sensors); } setListAdapter(adapter); } catch (Exception ex) { } }
From source file:net.reichholf.dreamdroid.activities.ServiceEpgListActivity.java
/** * Initializes the <code>SimpleListAdapter</code> *//*ww w . j a va2s . c om*/ private void setAdapter() { mAdapter = new SimpleAdapter(this, mMapList, R.layout.epg_list_item, new String[] { Event.EVENT_TITLE, Event.EVENT_START_READABLE, Event.EVENT_DURATION_READABLE }, new int[] { R.id.event_title, R.id.event_start, R.id.event_duration }); setListAdapter(mAdapter); }