从首选项启动意图时出现 ActivityNotFoundException

发布于 2024-09-30 16:08:42 字数 369 浏览 0 评论 0原文

test.class类型是否正确?怎样做?我应该怎么办?

<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 Intent** 
    </intent>  
</Preference> 

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 Intent** 
    </intent>  
</Preference> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柳絮泡泡 2024-10-07 16:08:42

我相信问题是问如何从 PreferenceScreen 启动活动。这可以通过在 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>

最后,确保活动已在清单中定义

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文