0
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lView = (ListView) findViewById(R.id.list1);
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ArrayList<ResolveInfo> list = (ArrayList<ResolveInfo>)pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm));
Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
}
lView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, results));
}
應用程序圖標如何修改這個代碼,以添加這些列出的應用程序有自己的圖標? main.xml中應包含哪些內容?列表與Android的
lView.setAdapter(新ArrayAdapter(這一點,android.R.layout.simple_list_item_1,getInstalledApps()))......它顯示的單詞列表...那麼,我需要爲此創建自己的佈局嗎? – Dummy1234
是的確切提到這個http://rkancharla.wordpress.com/2011/05/09/android-dynamic-list-view-with-image-and-text/ –