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:com.tk.httpClientErp.initialcheck.InitialcheckListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String mFirstInspectionData = getIntent().getStringExtra("firstInspectionData"); List<HashMap<String, Object>> firstInspectionData = jsonToListMap(mFirstInspectionData); MyStore.firstInspectionList = firstInspectionData; String[] from = new String[] { "id", "license", "lineName", "busTypeName", "spaceName", "xmName", "bus_no" };// ,"line_name","bus_type_name","space_name","xm_name" int[] to = new int[] { R.id.fi_id, R.id.fi_license, R.id.fi_lineName, R.id.fi_bus_type_name, R.id.fi_space_name, R.id.fi_xm_name, R.id.fi_bus_no }; SimpleAdapter adapter = new SimpleAdapter(this, MyStore.firstInspectionList, R.layout.activity_firstinspectionlist, from, to); setListAdapter(adapter);/*from ww w .j a v a 2s .c o m*/ }
From source file:com.tk.httpClientErp.headmancheck.HeadmancheckListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String mHeanmancheckData = getIntent().getStringExtra("heanmancheckData"); List<HashMap<String, Object>> headManCheackList = jsonToListMap(mHeanmancheckData); MyStore.headManCheckList = headManCheackList; MyStore.headManCheckFenzu = classification(headManCheackList); String[] from = new String[] { "gd_no", "xmname", "license", "workername", "baoyang", "bus_no" }; int[] to = new int[] { R.id.headmancheck_list_orderno, R.id.headmancheck_list_project, R.id.headmancheck_list_License, R.id.headmancheck_list_fix, R.id.headmancheck_list_maintenance, R.id.headmancheck_list_bus_no }; SimpleAdapter adapter = new SimpleAdapter(this, MyStore.headManCheckFenzu, R.layout.activity_headmanchecklist, from, to); setListAdapter(adapter);//from ww w . ja va 2 s. c o m }
From source file:com.tk.httpClientErp.inspectorfinalck.InspectorfinalckList.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String inspectorfinalckData = getIntent().getStringExtra("inspectorfinalckData"); List<HashMap<String, Object>> headManCheackDetail = jsonToListMap(inspectorfinalckData); List<HashMap<String, Object>> headManCheackfenzuList = classification(headManCheackDetail); MyStore.inspectorfinalckDetail = headManCheackDetail; MyStore.inspectorfinalckList = headManCheackfenzuList; String[] from = new String[] { "gd_no", "xm_name", "license", "bus_no" }; int[] to = new int[] { R.id.inspectorfinalck_list_orderno, R.id.inspectorfinalck_list_project, R.id.inspectorfinalck_list_License, R.id.inspectorfinalck_list_bus_no }; SimpleAdapter adapter = new SimpleAdapter(this, MyStore.inspectorfinalckList, R.layout.activity_inspectorfinalcklist, from, to); setListAdapter(adapter);//from w w w . j a va 2 s . c o m }
From source file:com.tk.httpClientErp.wsHeadCheck.WsHeadCheckList.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String mWsHeadCheckData = getIntent().getStringExtra("mWsHeadCheckData"); List<HashMap<String, Object>> headManCheackList = jsonToListMap(mWsHeadCheckData); MyStore.wsheadCheckList = headManCheackList; MyStore.wsheadCheckFenZuList = classification(headManCheackList); //List String[] from = new String[] { "detail", "gd_no", "license", "xm_name", "bus_no" }; int[] to = new int[] { R.id.wsheadcheck_detail, R.id.wsheadchecklist_gd_no, R.id.wsheadchecklist_licence, R.id.wsheadchecklist_project, R.id.wsheadchecklist_bus_no }; SimpleAdapter adapter = new SimpleAdapter(this, MyStore.wsheadCheckFenZuList, R.layout.activity_wsheadchecklist, from, to); setListAdapter(adapter);/*from www . j av a 2s . c o m*/ }
From source file:com.tk.httpClientErp.materialsrequest.MaterialsrequestFenzu.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMaterialsrequestData = getIntent().getStringExtra("mMaterialsrequestData"); List<HashMap<String, Object>> materialsrequestList = jsonToListMap(mMaterialsrequestData); fenzuList = classification(materialsrequestList); MyStore.mterialsrequestList = materialsrequestList; MyStore.mterialsrequestFenzu = fenzuList; String[] from = new String[] { "gd_no", "xm_name", "license", "gz_no", "headman_name", "workgroup_name", "bus_id", "bus_no" }; int[] to = new int[] { R.id.mterialsrequest_fenzu_gd_no, R.id.mterialsrequest_fenzu_xm_name, R.id.mterialsrequest_fenzu_license, R.id.mterialsrequest_fenzu_gz_no, R.id.mterialsrequest_fenzu_headman_name, R.id.mterialsrequest_fenzu_workgroup_name, R.id.mterialsrequest_fenzu_bus_id, R.id.mterialsrequest_fenzu_bus_no }; SimpleAdapter adapter = new SimpleAdapter(this, MyStore.mterialsrequestFenzu, R.layout.activity_materialsrequest_fenzu, from, to); setListAdapter(adapter);//from w w w.j a v a 2 s . co m }
From source file:com.example.demo_highlights.slidingmenu.fragment.PageFragment1.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.page1, null); mListView = (ListView) view.findViewById(R.id.listview); mListView.setAdapter(new SimpleAdapter(getActivity(), getData(), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 })); mListView.setOnItemClickListener(this); mListView.setDivider(getResources().getDrawable(R.drawable.jblineshape)); mListView.setDividerHeight(2);//from ww w . j a va 2 s . co m // mListView.setLayoutAnimation(/*controller*/getListAnim()); mListView.setFastScrollEnabled(true); return view; }
From source file:com.skubit.android.example.PurchasesFragment.java
public void displayPurchases(Context context, ListView view, ArrayList<String> purchases) throws JSONException { List<Map<String, String>> items = new ArrayList<Map<String, String>>(); for (String detail : purchases) { Map<String, String> map = new HashMap<String, String>(); JSONObject jo = new JSONObject(detail); map.put("title", jo.toString()); items.add(map);/*from w w w. j ava2s. c o m*/ } String[] from = new String[] { "title" }; int[] to = new int[] { android.R.id.text1 }; SimpleAdapter adapter = new SimpleAdapter(context, items, android.R.layout.simple_list_item_1, from, to); view.setAdapter(adapter); }
From source file:com.fangyuan.vpngate.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//from w ww. j a v a 2s. co m mContext = this; mListView = (ListView) findViewById(R.id.vpn_list); mListView.setDividerHeight(16); mListItems = new ArrayList<HashMap<String, Object>>(); SimpleAdapter adapter = new SimpleAdapter(this, mListItems, R.layout.vpn_summary, new String[] { "country", "ip" }, new int[] { R.id.country, R.id.ip }); mListView.setAdapter(adapter); hosts = getSharedPreferences("vpngate", MODE_PRIVATE).getString("hosts", null); if (hosts != null) { parseHostsString(hosts); } mHandler = new Handler() { public void handleMessage(Message msg) { hosts = msg.getData().getString("hosts"); if (hosts != null) { if (parseHostsString(hosts)) { SimpleAdapter adapter = (SimpleAdapter) mListView.getAdapter(); adapter.notifyDataSetChanged(); } } getActionBarHelper().setRefreshActionItemState(false); } }; }
From source file:com.skubit.android.example.SkusFragment.java
public void displaySkus(Context context, ListView view, ArrayList<String> details) throws JSONException { List<Map<String, String>> items = new ArrayList<Map<String, String>>(); for (String detail : details) { Map<String, String> map = new HashMap<String, String>(); JSONObject jo = new JSONObject(detail); map.put("title", jo.getString("title")); map.put("id", jo.getString("productId")); items.add(map);/*from w w w . j av a 2 s.co m*/ } String[] from = new String[] { "title" }; int[] to = new int[] { android.R.id.text1 }; SimpleAdapter adapter = new SimpleAdapter(context, items, android.R.layout.simple_list_item_1, from, to); view.setAdapter(adapter); }
From source file:com.loadsensing.app.LlistaXarxesActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xarxa_list_view); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); // adapter per mapejar els camps del layout amb la informaci de l'array SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.xarxa_row_list_view, new String[] { "nom", "poblacio", "sensors", "lat", "lon", "idXarxa", "nomThumbnail" }, new int[] { R.id.text1, R.id.text2, R.id.text3, R.id.text4, R.id.text5, R.id.text6, R.id.thumbnailxarxa }); adapter.setViewBinder(new setImageListView()); SharedPreferences settings = getSharedPreferences("LoadSensingApp", Context.MODE_PRIVATE); String address = SERVER_HOST + "?session=" + settings.getString("session", ""); Log.d(DEB_TAG, "Requesting to " + address); try {//from w w w .ja va 2 s. c o m String jsonString = JsonClient.connectString(address); // Convertim la resposta string a un JSONArray JSONArray llistaXarxesArray = new JSONArray(jsonString); HashMap<String, String> xarxa = null; // recorrer la llista de xarxes obtenint la informaci del JSON string for (int i = 0; i < llistaXarxesArray.length(); i++) { xarxa = new HashMap<String, String>(); JSONObject xarxaJSON = new JSONObject(); xarxaJSON = llistaXarxesArray.getJSONObject(i); // per mostrar la imatge de cada xarxa a la llista, fem una funci que ens retorna el nom de la imatge // segons quina id de xarxa es int nomImatge = obtenirNomImatge(xarxaJSON.getString("IdXarxa")); xarxa.put("id", String.valueOf(i)); xarxa.put("poblacio", xarxaJSON.getString("Poblacio")); xarxa.put("nom", xarxaJSON.getString("Nom")); xarxa.put("idXarxa", xarxaJSON.getString("IdXarxa")); xarxa.put("sensors", xarxaJSON.getString("Sensors")); xarxa.put("lat", xarxaJSON.getString("Lat")); xarxa.put("lon", xarxaJSON.getString("Lon")); xarxa.put("nomThumbnail", Integer.toString(nomImatge)); list.add(xarxa); } setListAdapter(adapter); } catch (Exception e) { Log.d(DEB_TAG, "Error rebent xarxes"); } }