안드로이드 개발 질문/답변
(글 수 45,052)
public class AppListTest extends ListActivity {
ListView appListView;
PackageManager pm;
List<ApplicationInfo> appList;
ArrayList<HashMap<String, Object>> appInstallArrayL = new ArrayList<HashMap<String,Object>>();
SimpleAdapter ad;
ApplicationInfo appInfo;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appFrame();
}
public void appFrame() {
pm = getPackageManager();
appList = pm.getInstalledApplications(0);
Collections.sort(appList, new ApplicationInfo.DisplayNameComparator(pm));
for (int i = 0; i < appList.size(); i++) {
appInfo = appList.get(i);
Drawable appDrawable = pm.getApplicationIcon(appInfo);
String appPackegeName = appInfo.packageName;
String appClassName = appInfo.className;
CharSequence appLabel = pm.getApplicationLabel(appInfo);
HashMap<String, Object> appItem = new HashMap<String, Object>();
appItem.put("icon", appDrawable);
appItem.put("PackageName", appPackegeName);
appItem.put("ClassName", appClassName);
appItem.put("Label", appLabel);
appInstallArrayL.add(appItem);
}
ad = new SimpleAdapter(this, appInstallArrayL, R.layout.app_list_item,
new String[] {"Label", "icon"}, new int[] {R.id.package_label, R.id.icon});
setListAdapter(ad);
}
현재 가지고 있는 앱 리스트를 뿌리려고 하는데
앱 아이콘을 가지고 오지 못하고 있습니다.
앱 아이콘 resourceid 값은 가지고 오는데 실행 해보면 아이콘이 이미지뷰에 들어오지 않습니다.
뭔가 잘못되긴 한것 같은데 뭐가 잘못 됬는지 잘 모르겠네요 ㅠㅠ
잘 못된 부분을 지적해 주시면 감사하겠습니다.



