java preference xml,java – 找不到PreferenceScreen类

java preference xml,java – 找不到PreferenceScreen类我在preferences.xml中有这个android:key=”displayNotification”android:title=”Displaynotification”/>android:entries=”@array/languages”android:key=”language”/>PreferencesActivity.java,使用此xml的类publicclas…

我在preferences.xml中有这个

android:key=”displayNotification”

android:title=”Display notification”

/>

android:entries=”@array/languages”

android:key=”language”

/>

PreferencesActivity.java,使用此xml的类

public class PreferencesActivity extends PreferenceActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.xml.preferences);

}

}

而且我在清单中宣布它是这样的

当我开始活动时,我得到一个未找到的类异常,我不明白.

05-17 00:35:13.633: ERROR/AndroidRuntime(212): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tellthetime/com.tellthetime.PreferencesActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class PreferenceScreen

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread.access$2200(ActivityThread.java:119)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.os.Handler.dispatchMessage(Handler.java:99)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.os.Looper.loop(Looper.java:123)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread.main(ActivityThread.java:4363)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at java.lang.reflect.Method.invokeNative(Native Method)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at java.lang.reflect.Method.invoke(Method.java:521)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at dalvik.system.NativeStart.main(Native Method)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class PreferenceScreen

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.Activity.setContentView(Activity.java:1622)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at com.tellthetime.PreferencesActivity.onCreate(PreferencesActivity.java:13)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): … 11 more

05-17 00:35:13.633: ERROR/AndroidRuntime(212): Caused by: java.lang.ClassNotFoundException: android.view.PreferenceScreen in loader dalvik.system.PathClassLoader@44c067e8

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.createView(LayoutInflater.java:466)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)

05-17 00:35:13.633: ERROR/AndroidRuntime(212): … 19 more

这已被问到here,但没有人回答.正如Heiko Rupp在那个帖子中所指出的那样,android正在寻找android.view包中的类,但是这个类在android.preferences中,这真的让我失望了.

今天的文章java preference xml,java – 找不到PreferenceScreen类分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/26190.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注