ActivityNotFoundException when launching intent from preferences
test.class type is right? How to? What should I do?
<Preference
android:key="test"
android:title="test"
android:summary="test">
<intent android:action="test.class" > <=== **ERROR/AndroidRuntime(2384): android.content.ActivityNotFoundException: No Activity found to handle Inte开发者_运维知识库nt**
</intent>
</Preference>
I believe the question is asking how to launch an activity from a PreferenceScreen. This can be achieved using the following definition in your XML:
<Preference
android:title="Tap me"
android:summary="Tap to start activity">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.example"
android:targetClass="com.example.MyActivityClass" />
</Preference>
Finally, make sure the Activity is defined in your manifest.
精彩评论