DialogPreference is an abstract class and cannot be instantiated.
There was a bug in the VM in 1.5 that would allow abstract classes to
be instantiated through reflection. Sorry it broke your app but the
1.6 behavior is the correct one. Having an instance of an abstract
class is very wrong and could lead to all sorts of problems.

On Mon, Sep 28, 2009 at 5:14 PM, Lee <labor...@gmail.com> wrote:
>
> Code that was working fine on 1.5 is now trapping on 1.6 while
> inflating a DialogPreference.  I've got a tab host and one of the tabs
> is hosting a PreferenceActivity.  In the onCreate of the preference
> activity the preferences are loaded from XML using the following call:
>
>    public void onCreate(Bundle savedInstanceState)
>    {
>        super.onCreate(savedInstanceState);
>        addPreferencesFromResource(R.xml.preferences);
>     }
>
> The stack trace is shown below - this seems like a regression from
> 1.5...
>
>
> 09-29 10:05:44.104: ERROR/AndroidRuntime(784): Uncaught handler:
> thread main exiting due to uncaught exception
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):
> java.lang.RuntimeException: Unable to start activity ComponentInfo
> {com.XXXXXX.client.gui/
> com.XXXXXXX.client.preferences.PreferencesActivity}:
> android.view.InflateException: Binary XML file line #172: Error
> inflating class java.lang.reflect.Constructor
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2401)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.ActivityThread.startActivityNow(ActivityThread.java:2242)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.LocalActivityManager.moveToState(LocalActivityManager.java:
> 127)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.LocalActivityManager.startActivity
> (LocalActivityManager.java:339)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.widget.TabHost$IntentContentStrategy.getContentView
> (TabHost.java:631)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.widget.TabHost.setCurrentTab(TabHost.java:317)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:127)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:346)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.View.performClick(View.java:2344)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.View.onTouchEvent(View.java:4133)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.View.dispatchTouchEvent(View.java:3672)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:850)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
> (PhoneWindow.java:1202)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.Activity.dispatchTouchEvent(Activity.java:1987)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.os.Looper.loop(Looper.java:123)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.ActivityThread.main(ActivityThread.java:4203)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> (ZygoteInit.java:791)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> dalvik.system.NativeStart.main(Native Method)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784): Caused by:
> android.view.InflateException: Binary XML file line #172: Error
> inflating class java.lang.reflect.Constructor
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.createItem(GenericInflater.java:
> 397)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.onCreateItem(GenericInflater.java:
> 417)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.createItemFromTag
> (GenericInflater.java:428)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.rInflate(GenericInflater.java:481)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.inflate(GenericInflater.java:326)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.inflate(GenericInflater.java:263)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.PreferenceManager.inflateFromResource
> (PreferenceManager.java:250)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.PreferenceActivity.addPreferencesFromResource
> (PreferenceActivity.java:253)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> com.XXXXXX.client.preferences.PreferencesActivity.onCreate
> (PreferencesActivity.java:177)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1123)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2364)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     ... 30 more
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784): Caused by:
> java.lang.InstantiationException: android.preference.DialogPreference
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> java.lang.reflect.Constructor.constructNative(Native Method)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> java.lang.reflect.Constructor.newInstance(Constructor.java:446)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     at
> android.preference.GenericInflater.createItem(GenericInflater.java:
> 383)
> 09-29 10:05:44.153: ERROR/AndroidRuntime(784):     ... 40 more
>
> >
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to