简体   繁体   English

如何使应用程序的启动图标运行首选项活动?

[英]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. 首选项在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: 您需要为您的首选项(PreferenceActivity)创建一个活动,将该活动添加到清单中,并提供如下所示的适当的Intent过滤器以通过启动器运行:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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