I have two activities - MainActivity
and PrefActivity
. MainActivity
- activity with button, when I click on it, it refer me to the PrefActivity PrefActivity
- preferenceactivity
with ListPreference
.
How to open or click on the ListPreference
automatically while PrefActivity
is opening?
Use startActivityForResult to transfer control from MainActivity to PrefActivity. Once complete you'll return control back to MainActivity.
That said, you'll typically only want to automatically direct users to preferences the first time they use the app. In that case you can use Shared Preferences to record that prefs have been set. (Eg, flip sharedPref boolean value to true.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.