简体   繁体   中英

How do I make an applcation's launch icon run the preferences activity?

I would like an app's launch icon run the app's preferences activity (as it has no Activities, only a Service).

The preferences are defined in res/xml/preferences.xml.

Please help me regarding this.

you need to create an activity for your preference (PreferenceActivity), add that activity in your manifest and provide appropriate intent-filters as shown below to run through launcher:

<activity android:name=".MyPreferenceActivity" android:label="Preferences" android:noHistory="true">
    <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM