Question

This is my .java code

   public class MainHelp extends PreferenceActivity {

        @Override
        public void onCreate(Bundle savedInstanceState){
            super.onCreate(savedInstanceState);
                addPreferencesFromResource(R.xml.help_main);
             }
       }

and this is the layout

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

    <Preference 
        android:title="Commands Documentation"
        android:key="@string/commands"/>

     <Preference
         android:title = "How To Use"
         android:key="@string/howToUse"/>
     <Preference 
         android:title="Write Us"
         android:key="@string/writeUs"/> 
     <Preference 
        android:title="About"
        android:key="@string/aboutSuppApp"/> 
</PreferenceScreen>

When I run the program the above code works perfectly....But, when i hit home button and try to go to this Activity, I get error saying

E/AndroidRuntime(  495): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(  495): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.suppapp/com.suppapp.help.MainHelp}: android.view.InflateException: Binary XML file line #10: Error inflating class prferences
    E/AndroidRuntime(  495):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
    E/AndroidRuntime(  495):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
    E/AndroidRuntime(  495):    at android.app.ActivityThread.access$2200(ActivityThread.java:119)
    E/AndroidRuntime(  495):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
    E/AndroidRuntime(  495):    at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(  495):    at android.os.Looper.loop(Looper.java:123)
    E/AndroidRuntime(  495):    at android.app.ActivityThread.main(ActivityThread.java:4363)
    E/AndroidRuntime(  495):    at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(  495):    at java.lang.reflect.Method.invoke(Method.java:521)
    E/AndroidRuntime(  495):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
    E/AndroidRuntime(  495):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    E/AndroidRuntime(  495):    at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime(  495): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class prferences
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.inflate(GenericInflater.java:326)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.inflate(GenericInflater.java:263)
    E/AndroidRuntime(  495):    at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:254)
    E/AndroidRuntime(  495):    at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:253)
    E/AndroidRuntime(  495):    at com.suppapp.help.MainHelp.onCreate(MainHelp.java:19)
    E/AndroidRuntime(  495):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    E/AndroidRuntime(  495):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
    E/AndroidRuntime(  495):    ... 11 more
    E/AndroidRuntime(  495): Caused by: java.lang.ClassNotFoundException: android.preference.prferences in loader dalvik.system.PathClassLoader@44c06600
    E/AndroidRuntime(  495):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
    E/AndroidRuntime(  495):    at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
    E/AndroidRuntime(  495):    at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.createItem(GenericInflater.java:375)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
    E/AndroidRuntime(  495):    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
    E/AndroidRuntime(  495):    ... 19 more 

I tried to link my activity with the other .xml file but getting the same error again!! Even Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class prferences shows the same line number(#10) for other .xml files

Was it helpful?

Solution

i changed the version code(inside manifest file) and re-installed the app...its working fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top