android - Why is the icon not being displayed but the name of icon is being written in list -


i have code display apps installed in device...its working fine want show icon of aal apps instead of showing icon, name of icon written in list. like

android.graphics.drawable.bitmapdrawable@405369f0 

what do??? code

private arraylist<string> application_name = new arraylist<string>(); private arraylist<drawable> application_icon = new arraylist<drawable>(); packageinfo pinfo; string packagename; string app; list<resolveinfo> list; textview apple; string myapps_name[]= new string[application_name.size()]; drawable myapps_icon[]= new drawable[application_icon.size()]; resolveinfo rinfo;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     //setcontentview(r.layout.activity_main);      //lview = (listview) findviewbyid(r.id.list);     packagemanager pm = this.getpackagemanager();      intent intent = new intent(intent.action_main, null);     intent.addcategory(intent.category_launcher);      list = pm.queryintentactivities(intent, packagemanager.permission_granted);     (resolveinfo rinfo: list)     {       application_name.add((string) rinfo.activityinfo.applicationinfo.loadlabel(pm));       application_icon.add(rinfo.activityinfo.applicationinfo.loadicon(pm));        log.w("installed applications", rinfo.activityinfo.applicationinfo.loadlabel(pm).tostring());     }     getlistview().setonitemclicklistener(this);      myapps_name = application_name.toarray(myapps_name);     myapps_icon=application_icon.toarray(myapps_icon);      setlistadapter(new arrayadapter(this, android.r.layout.simple_list_item_1, myapps_icon)); }  @override public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) {     //     final intent intent = new intent(intent.action_main);     final activityinfo info = list.get(arg2).activityinfo;     intent.setclassname(info.packagename, info.name);     // intent.setflags(intent.flag_activity_new_task | intent.flag_activity_reset_task_if_needed);     startactivity(intent); } 

and if possible want show both icon , app name every installed apps

to achieve want have subclass, in case, arrayadapter , override getview method . infact getview responsible return view want show.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -