Android Question clickable list to launch another app [Solved]

trepdas

Active Member
Licensed User
Longtime User
Hello good people,
I have this Erel's example to list installed app.


B4X:
Private Sub ShowInstalledApps
   Dim pm As PackageManager  'phone library
   For Each pck As String In pm.GetInstalledPackages
     Dim name As String = pm.GetApplicationLabel(pck)
     Log(name)
   Next
End Sub


can this list be clickable to launch the apps ?
if so, how ?

?
 

Mahares

Expert
Licensed User
Longtime User
No Problem :)
Thank you
I don't think the code that Saif posted is correct. But then again who am I to argue with the powerhouse Saif (The Sword). The value returned by the item click in the listview should be the package name, then the intent code in the item click should be quite different from what you have.
This line:
B4X:
lst.AddSingleLine2(pm.GetApplicationLabel(pck),pm.GetApplicationIntent(pck))
should be:
B4X:
lst.AddSingleLine2(pm.GetApplicationLabel(pck),pck)
the Sub lst_ItemClick (Position As Int, Value As Object) code you have needs to change also.
It is also preferable to use an xCLV instead of Listview
 
Upvote 0

trepdas

Active Member
Licensed User
Longtime User
Thank you very much Mahares and sfsameer.
right after I tested it and it crashed I see here that the answer is already there !
? ?
 
Upvote 0
Top