I want to launch System's Location Settings from an Intent
. I know that programmatically it goes like this
Intent viewIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(viewIntent);
but I need to do it from the XML of a Preference
. I try like this
<Preference
android:title="@string/pref_title" >
<intent android:action="android.settings.ACTION_LOCATION_SOURCE_SETTINGS" />
</Preference>
but it does not work, I always get an ActivityNotFoundException
. How can I launch that System Location Settings from an XML Intent?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…