Android Question what is the reason? show the error info

yhyzhj

Member
i want to get some icons of app, show the error info. when press yes button, app can run and show icons
 

yhyzhj

Member
code::
    Dim appn(packages.size) As String
    Dim pkgn(packages.size) As String
    Dim ver(packages.Size) As String
    Dim icon As BitmapDrawable
    Dim n as int
    n=0
    For i = 0 To packages.Size - 1
        appn(n)=pm.GetApplicationLabel(packages.Get(i))
        pkgn(n)=packages.Get(i)
        icon=pm.GetApplicationIcon(pkgn(i))
        ver(n)=pm.GetVersionName(pkgn(n))
        ListView1.AddTwoLinesAndBitmap(appn(n)&"  "&ver(n),pkgn(n),icon.Bitmap)
        n=n+1
    Next
 
Upvote 0

yhyzhj

Member
still show error:

B4A Version: 11.20
Parsing code. (0.01s)
Java Version: 8
Building folders structure. (0.01s)
Compiling code. Error
Error compiling program.
Error description: 'Then' expected.
Error occurred on line: 76
If o Is BitmapDrawable=False Then Continue
Word: =
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
BitmapDrawable=False Then
It seems you've fixed, but in the 2nd line from Erel, "Then" is missing the final "n".
If you get an error, it would be fine you'd show your code, to see what's in the line 76.
 
Upvote 0

yhyzhj

Member
B4X:
If (o Is BitmapDrawable) = False Then Continue
now still show error when run the app
my code:
packages = pm.GetInstalledPackages
    Dim appn(packages.size) As String
    Dim pkgn(packages.size) As String
    Dim ver(packages.Size) As String
    Dim o As Object
    n=0
    For i = 0 To packages.Size - 1
        appn(n)=pm.GetApplicationLabel(packages.Get(i))
        pkgn(n)=packages.Get(i)
        o = pm.GetApplicationIcon(pkgn(i))
        If (o Is BitmapDrawable)=False Then Continue
        ver(n)=pm.GetVersionName(pkgn(n))
        ListView1.AddTwoLinesAndBitmap(appn(n)&"  "&ver(n),pkgn(n),o)
        n=n+1
    Next
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should never see this error dialog. Add the Starter service back.
2. Post the full error message from the logs.
3. Never use ListView. You are simply wasting your time. Use xCustomListView instead.
4:
B4X:
ListView1.AddTwoLinesAndBitmap(appn(n)&"  "&ver(n),pkgn(n),o.As(BitmapDrawable).Bitmap)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…