Android Question Save Installed Apps Icon as File

HI Guys

How can I save installed apps icon as file ex : app..png or jpg

This is my code for get installed apps package name and name :

B4X:
Private Sub ShowInstalledApps
    
    Dim pm As PackageManager  'phone library
    For Each pck As String In pm.GetInstalledPackages
        If IsSystemApp(pck) <> True Then
            Dim Item As Apps
            Item.Initialize
            Item.PkName = pck
            Item.LbName = pm.GetApplicationLabel(pck)
            List.Add(Item)
        End If
    Next
    LV.notifyDataSetChanged
    
End Sub

Sub IsSystemApp (PackageName As String) As Boolean
    
    Dim jo As JavaObject
    jo.InitializeContext
    Dim flags As Int = jo.RunMethodJO("getPackageManager", Null).RunMethodJO("getApplicationInfo", _
     Array (PackageName, 0)).GetField("flags")
    Return Bit.And(flags, 1) = 1 'FLAG_SYSTEM
    
End Sub

and for get the app icon ( how to save this as a file ? ) :

B4X:
PCM.GetApplicationIcon(item.PkName) ' PCM as PackageManager

Thanks All
 
Top