SearchableActivity.java
...前略... public void query_AP() { //列出所有AP PackageManager manager = context.getPackageManager(); ListapplicationInfos = manager.getInstalledApplications(0); Iterator iterator = applicationInfos.iterator(); try { lstStringItem = new ArrayList >(); do { ApplicationInfo applicationInfo = iterator.next(); HashMap resultMap = new HashMap (); resultMap.put("packageName", applicationInfo.packageName); resultMap.put("packageLabel", manager.getApplicationLabel(applicationInfo).toString()); lstStringItem.add(resultMap); }while(iterator.hasNext()); } catch (Exception e) { } SimpleAdapter saImageItems = new SimpleAdapter(this, lstStringItem, R.layout.ap_item,//TextView*2 new String[] {"packageName", "packageLabel"}, new int[] {R.id.AP_TextView01, R.id.AP_TextView02} ); listview.setAdapter(saImageItems); } ... //
沒有留言:
張貼留言