Load Activity and/or Application Logo Programmatically from Manifest

前端 未结 4 1808
南旧
南旧 2021-01-04 04:27

I am trying to load the logo associated with the current activity and/or its parent application from the definition in the manifest. This technique has already worked succes

4条回答
  •  旧巷少年郎
    2021-01-04 05:09

    First you need to find all the applications that are installed. For this purpose us the following methods from package manager,

    public abstract List getInstalledPackages (int flags)
    

    more info here

    You can also use the following method for getting info on installed packages.

    public abstract List getInstalledApplications (int flags)
    

    more info here

    Now after getting the list, iterate it using the following method.

    public Drawable getDrawable(String packageName,int resid,ApplicationInfo appInfo)
    

    more info here

    Each iteration will give you the respective drawable of the package queried. here res id is the id of the icon..

    R.drawable.icon
    

提交回复
热议问题