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 5979325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:38:36+00:00 2026-05-22T21:38:36+00:00

Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a

  • 0

Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a password dialog before one can edit the preference by the EditTextPreference‘s own dialog.

Now I define the preference in the corresponding preferences.xml like this:

<edu.myproject.pwprefs.PasswordProtectedEditTextPreference android:key="pref_password"
            android:title="@string/pref_password_title" android:summary="@string/pref_password_summary"
            android:dialogTitle="@string/pref_password_dialog_title" android:dialogMessage="@string/pref_password_dialog_message">
</edu.myproject.pwprefs.PasswordProtectedEditTextPreference>

Then I apply preferences.xml in my subclass of PreferenceActivity by calling

addPreferencesFromResource(R.xml.preferences);

during onCreate(). This all works fine using Android 1.5. However, when I use a higher Android version, I get the following stacktrace:

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.myproject/edu.myproject.Preferences}: android.view.InflateException: Binary XML file line #25: Error inflating class java.lang.reflect.Constructor
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:144)
     at android.app.ActivityThread.main(ActivityThread.java:4937)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:521)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
     at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class java.lang.reflect.Constructor
     at android.preference.GenericInflater.createItem(GenericInflater.java:397)
     at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
     at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
     at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
     at android.preference.GenericInflater.inflate(GenericInflater.java:326)
     at android.preference.GenericInflater.inflate(GenericInflater.java:263)
     at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:254)
     at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:268)
     at edu.myproject.Preferences.onCreate(Preferences.java:50)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
     ... 11 more
 Caused by: java.lang.InstantiationException: edu.myproject.pwprefs.PasswordProtectedEditTextPreference
     at java.lang.reflect.Constructor.constructNative(Native Method)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
     at android.preference.GenericInflater.createItem(GenericInflater.java:383)
     ... 21 more

Any idea what’s happening here?

Edit: #25 from the stacktrace corresponds to the PasswordProtectedEditTextPreference in preferences.xml

Edit: This is my PasswordProtectedEditTextPreference:

package edu.myproject.pwprefs;

import edu.myproject.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.EditText;
import android.widget.LinearLayout;

public abstract class PasswordProtectedEditTextPreference extends EditTextPreference {

    public PasswordProtectedEditTextPreference(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }

    public PasswordProtectedEditTextPreference(Context context,
            AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
    }

    public PasswordProtectedEditTextPreference(Context context,
            AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }


    // further non-instantiation related code
}
  • 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-22T21:38:36+00:00Added an answer on May 22, 2026 at 9:38 pm

    You created an abstract class:

      public abstract class PasswordProtectedEditTextPreference  
    

    No wonder it can’t be instantiated 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIViewController subclass called TripViewController. This class has the following method: -
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)
Assume you have some objects which have several fields they can be compared by:
Assume we have a method like this: public IEnumerable<T> FirstMethod() { var entities =
Assume you have five products, and all of them use one or more of
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Assume I have a table called User . Using LINQ desinger, I will end
It is possible to have one NSManagedObject subclass represent multiple Core Data entities. For
Assume I have a class like this: public class Foo { public Bar RequiredProperty
Assume I have a class foo, and wish to use a std::map to store

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.