<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="progressBar"
android:title="@string/progressBar">
<intent
android:action="com.progress.views"/>
</Preference>
</PreferenceScreen>
在上面的xml中,想通过intent action 来指定对应的activity。
在AndroidMainfest.xml中
<activity android:name=".progress.ProgressActivity">
<intent-filter>
<action android:name="com.progress.views"/>
</intent-filter>
</activity>
运行后来时报错
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.progress.views }
后来发现必需添加
<intent-filter>
<action android:name="com.progress.views"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>