i have with this a list with the applications instaled.
the problem is the order of the listview and i want only see applicatons instaled by the user not system applications.
Any idea?
Thank you
B4X:
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ls As ListView
Dim list1 As List
Dim pm As PackageManager
Dim Packages As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("voz")
vamos
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub vamos
Dim icon As BitmapDrawable
Dim AppPckgName As String
list1.Initialize
Packages.Initialize
Packages = pm.GetInstalledPackages
' icon.InitializeMutable(48dip,48dip)
For i = 0 To Packages.Size - 1
AppPckgName = Packages.Get(i)
icon=pm.GetApplicationIcon(AppPckgName)
ls.AddTwoLinesAndBitmap(pm.GetApplicationLabel(Packages.Get(i)),Packages.get(i),icon.Bitmap)
list1.Add(Packages.Get(i))
Next
ls.FastScrollEnabled = True
End Sub
Sub ls_ItemClick (Position As Int, Value As Object)
Dim i As Intent
i.Initialize(list1.Get(Position),"")
i = pm.GetApplicationIntent(list1.Get(Position))
Try
StartActivity(i)
Catch
ToastMessageShow("no se puede",False)
End Try
End Sub
Sub ls_ItemLongClick (Position As Int, Value As Object)
Dim i As Intent
i.Initialize("android.intent.action.DELETE", "package:" & list1.Get(Position))
StartActivity(i)
End Sub
Any idea?
Thank you