Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5929393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:24:57+00:00 2026-05-22T14:24:57+00:00

I have this in preferences.xml <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <CheckBoxPreference android:key=displayNotification android:title=Display notification

  • 0

I have this in preferences.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <CheckBoxPreference
        android:key="displayNotification"
        android:title="Display notification"
        />

    <ListPreference
        android:entries="@array/languages"
        android:key="language"
        />
</PreferenceScreen>

PreferencesActivity.java, the class that uses this xml

public class PreferencesActivity extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.xml.preferences);
    }
}

And I have it declared in the manifest like this

<activity android:name="com.tellthetime.PreferencesActivity" />

When I start the activity I get a class not found exception, which I don’t understand.

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

This was already asked here but no one answered. As pointed out in that thread by Heiko Rupp, android is looking for the class in the package android.view, but the class is in android.preferences, this really lost me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:24:58+00:00Added an answer on May 22, 2026 at 2:24 pm

    You’re getting confused, you’re trying to set the preference definition as the layout definition. First set a layout for the Activity, then bind your preferences XML:

      ...
      setContentView(R.layout.layout);
      addPreferencesFromResource(R.xml.preferences);
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this preferences.xml file: <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android android:title=@string/preference_main> <PreferenceScreen android:title=@string/preference_sight android:key=category_sight> <ListPreference
I have created a custom Button as follows. file : buttoncontrol.xml <?xml version=1.0 encoding=utf-8?>
I have this textbox I use to capture keyboard shortcuts for a preferences config.
I have this line in a javascript block in a page: res = foo('<%=
I have a rather fundamental question about XML here. When declaring an element's xmlns
I have a small ap with preferences. In this class I've set the onPreferenceClick
I tried this: http://channel9.msdn.com/posts/RobBagby/deCast-Entity-Framework-Modeling-Implementing-Entity-Splitting/Default.aspx?wa=wsignin1.0 ...with the Northwind sample database from Codeplex, using the Employee
I have a PreferenceActivity that loads its preferences from an XML file which looks
This is the Android Live Wallpaper. .LiveWallpaperSettings is main activity with settings preferences. <-
I have a PreferenceCategory , xml file and I have defined all preferences in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.