i am trying to hide app icon from launcher
i tried the following code without any success
i tried the following code without any success
B4X:
Sub Activity_Create(FirstTime As Boolean)
PMsetComponentEnabledSetting(true)
End Sub
Sub PMsetComponentEnabledSetting (enable As Boolean)
Dim r As Reflector
Dim cn As Object = r.CreateObject2("android.content.ComponentName", _
Array As Object("cb56.testtwoicons", "cb56.testtwoicons.activity2"), Array As String("java.lang.String", "java.lang.String"))
r.Target = r.GetContext
r.Target = r.RunMethod("getPackageManager")
'COMPONENT_ENABLED_STATE_ENABLED = 1
'COMPONENT_ENABLED_STATE_DISABLED = 2
Dim e As Int
If enable = True Then
e = 1
Else
e = 2
End If
r.Target = r.RunMethod4("setComponentEnabledSetting", Array As Object(cn, e, 0), _
Array As String("android.content.ComponentName", "java.lang.int", "java.lang.int"))
End Sub