Error ActivityNotFoundException on Android 3.X

Orlando

Member
Licensed User
Longtime User
Hi, i've a problem with this code:

B4X:
Sub btnAdminApps_Click
    Dim intent1 As Intent
    intent1.Initialize("android.intent.action.MAIN","")
    intent1.SetComponent("com.android.setting/.APPLICATION_SETTINGS")
    StartActivity(intent1)
End Sub
On my phone with Android 2.3 works great but on my tablet with Android 3.2 does not work, I get the follow message:



android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.setting/com.android.setting.APPLICATION_SETTINGS}; have you declared this activity in your AndroidManifest.xml?



how can i fix it?

thanks

Orlando
 

NJDude

Expert
Licensed User
Longtime User
Change this line from:
B4X:
intent1.SetComponent("com.android.setting/.APPLICATION_SETTINGS")
to:
B4X:
intent1.SetComponent("com.android.setting/.ApplicationSettings")

However, that activity might not exist on other devices.
 
Last edited:
Upvote 0

Orlando

Member
Licensed User
Longtime User
I've tried this code and it works, why?

B4X:
Dim DoAction As Intent
    DoAction.Initialize("android.settings.APPLICATION_SETTINGS", "")
    StartActivity(DoAction)
 
Last edited:
Upvote 0
Top