Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:43:03+00:00 2026-05-27T10:43:03+00:00

How to get the application icon that i got from the result into arraylist?

  • 0

How to get the application icon that i got from the result into arraylist?

If i use
attrs.icon("Package Name", pkg.applicationInfo.loadIcon(getPackageManager()));

it show this error
The method icon(String, Drawable) is undefined for the type Map

if i use
attrs.put("Package Name", pkg.applicationInfo.loadIcon(getPackageManager()));

it show this error
The method put(String, String) in the type Map is not applicable for the arguments (String, Drawable)

i have tried

Drawable icon;

attrs.icon("Package Name", pkg.applicationInfo.loadIcon(getPackageManager()));

Drawable Icon = pm.getApplicationIcon(pkg.applicationInfo);

all giving error on eclipse

Here’s the code

protected void onPostExecute(List < PackageInfo > result) {

    // Here you will have all the setAdapter related code
    List < PackageInfo > adPackages = result;
    PackageManager pm = getPackageManager();

    List < Map < String, String >> data = new ArrayList < Map < String, String >> (
    adPackages.size());

    for (PackageInfo pkg: adPackages) {
        Map < String, String > attrs = new HashMap < String, String > ();

        attrs.put("App Name", pm.getApplicationLabel(pkg.applicationInfo).toString());
        attrs.put("Package Name", pkg.packageName);
        //Drawable icon;
        //attrs.icon("Package Name", pkg.applicationInfo.loadIcon(getPackageManager()));
        // Drawable Icon = pm.getApplicationIcon(pkg.applicationInfo);
        data.add(attrs);

    }

    String[] from = new String[] {
        "App Name", "Package Name"
    };
    int[] to = new int[] {
        R.id.text1, R.id.text2
    };
    SimpleAdapter adapter = new SimpleAdapter(
    AppsInspectorActivity.this, data, R.layout.two_line_list_item, from, to);

    ListView mList = (ListView) findViewById(R.id.l_list);

    mList.setAdapter(adapter);
    mPackages = adPackages;

}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:43:03+00:00Added an answer on May 27, 2026 at 10:43 am

    attrs is a Map so it doesn’t have a method called “icon”. You need to just do attrs.put("icon",pkg.applicationInfo.icon+"");
    the +"" is there because pkg.applicationInfo.icon is an integer so you need to convert it to a String before you can put it into a map parameterized with

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way I can get application name, application version and application icon,
What is the best way to get the application name (i.e MyApplication.exe) of the
I know enough to know that we need to get our application to deploy
I have a WPF application that needs to extract the icon off of an
I've got an IntPtr marshaled across an unmanaged/managed boundary that corresponds to an Icon
I have an application that uses images from web a a source. for my
I've got a code that lists the running application on a win32 box, and
I've got an application (that is targetting .Net Framework 2.0) that is running on
Here's the part of the Manifest that I believe is important: <application android:icon=@drawable/icon android:label=TestApplication
For an unknown reason, I can't get my application leaving properly so that when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.