2

My app for some inexplicable reasons is crashing on an HTC Desire HD. It's working fine in other phones as well as the emulator. Here is the crash report:

"java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.HomeActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class android.widget.EditText
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2833)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
    at android.app.ActivityThread.access$2300(ActivityThread.java:136)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:5068)
    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 #30: Error inflating class android.widget.EditText
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
    at android.app.Activity.setContentView(Activity.java:1686)
    at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
    ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
    at android.widget.EditText.<init>(EditText.java:53)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    ... 26 more
Caused by: java.lang.NullPointerException
    at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
    at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
    at android.widget.TextView.setText(TextView.java:2712)
    at android.widget.TextView.setText(TextView.java:2590)
    at android.widget.EditText.setText(EditText.java:84)
    at android.widget.TextView.setText(TextView.java:2565)
    at android.widget.TextView.setTransformationMethod(TextView.java:1209)
    at android.widget.TextView.applySingleLine(TextView.java:6024)
    at android.widget.TextView.setSingleLine(TextView.java:6015)
    at android.widget.TextView.setSingleLine(TextView.java:5992)
    at android.widget.TextView.<init>(TextView.java:863)
    at android.widget.EditText.<init>(EditText.java:57)
    ... 30 more
android.view.InflateException: Binary XML file line #30: Error inflating class android.widget.EditText
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
    at android.app.Activity.setContentView(Activity.java:1686)
    at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
    at android.app.ActivityThread.access$2300(ActivityThread.java:136)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:5068)
    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: java.lang.reflect.InvocationTargetException
    at android.widget.EditText.<init>(EditText.java:53)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    ... 26 more
Caused by: java.lang.NullPointerException
    at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
    at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
    at android.widget.TextView.setText(TextView.java:2712)
    at android.widget.TextView.setText(TextView.java:2590)
    at android.widget.EditText.setText(EditText.java:84)
    at android.widget.TextView.setText(TextView.java:2565)
    at android.widget.TextView.setTransformationMethod(TextView.java:1209)
    at android.widget.TextView.applySingleLine(TextView.java:6024)
    at android.widget.TextView.setSingleLine(TextView.java:6015)
    at android.widget.TextView.setSingleLine(TextView.java:5992)
    at android.widget.TextView.<init>(TextView.java:863)
    at android.widget.EditText.<init>(EditText.java:57)
    ... 30 more
java.lang.reflect.InvocationTargetException
    at android.widget.EditText.<init>(EditText.java:53)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
    at android.app.Activity.setContentView(Activity.java:1686)
    at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
    at android.app.ActivityThread.access$2300(ActivityThread.java:136)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:5068)
    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: java.lang.NullPointerException
    at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
    at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
    at android.widget.TextView.setText(TextView.java:2712)
    at android.widget.TextView.setText(TextView.java:2590)
    at android.widget.EditText.setText(EditText.java:84)
    at android.widget.TextView.setText(TextView.java:2565)
    at android.widget.TextView.setTransformationMethod(TextView.java:1209)
    at android.widget.TextView.applySingleLine(TextView.java:6024)
    at android.widget.TextView.setSingleLine(TextView.java:6015)
    at android.widget.TextView.setSingleLine(TextView.java:5992)
    at android.widget.TextView.<init>(TextView.java:863)
    at android.widget.EditText.<init>(EditText.java:57)
    ... 30 more
java.lang.NullPointerException
    at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
    at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
    at android.widget.TextView.setText(TextView.java:2712)
    at android.widget.TextView.setText(TextView.java:2590)
    at android.widget.EditText.setText(EditText.java:84)
    at android.widget.TextView.setText(TextView.java:2565)
    at android.widget.TextView.setTransformationMethod(TextView.java:1209)
    at android.widget.TextView.applySingleLine(TextView.java:6024)
    at android.widget.TextView.setSingleLine(TextView.java:6015)
    at android.widget.TextView.setSingleLine(TextView.java:5992)
    at android.widget.TextView.<init>(TextView.java:863)
    at android.widget.EditText.<init>(EditText.java:57)
    at android.widget.EditText.<init>(EditText.java:53)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
    at android.app.Activity.setContentView(Activity.java:1686)
    at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
    at android.app.ActivityThread.access$2300(ActivityThread.java:136)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:5068)
    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)
"

The crash seems to be happening when setting a value for EditText. Here is the EditText field in the XML:

<EditText style="@style/HomeInput" android:id="@+id/signin_username"
                    android:capitalize="none"
                    android:imeOptions="actionDone"
                    android:inputType="text"
                    android:text=""
                    android:maxLines="1"/>

Is anything wrong with the XML? If yes, why is it working in the emulator or other phones?

Edit 1

Here is the style XML

  <style name="HomeInput">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">wrap_content</item>      
    <item name="android:textSize">@dimen/text_size_small</item>
    <item name="android:textColor">@color/signin_input</item>
    <item name="android:layout_marginTop">10dip</item>
    <item name="android:layout_marginBottom">5dip</item>
    <item name="android:layout_marginLeft">10dip</item>
    <item name="android:layout_marginRight">10dip</item>
</style>

Edit 2

Submitted the bug report to Google: http://code.google.com/p/android/issues/detail?id=16640&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

Edit 3

The app crashes with an EditTextPreference inflated from xml/preferences.xml. Here is the crash report:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vtcreator.android360/com.myapp.SettingsActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class java.lang.reflect.Constructor
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2852)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873)
at android.app.ActivityThread.access$2300(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2186)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:5127)
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:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class java.lang.reflect.Constructor
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
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 com.myapp.SettingsActivity.onCreate(SettingsActivity.java:39)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2816)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.preference.EditTextPreference.<init>(EditTextPreference.java:71)
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)
... 22 more
Caused by: java.lang.NullPointerException
at com.htc.quickselection.HtcQuickSelectionWindow.<init>(HtcQuickSelectionWindow.java:164)
at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:326)
at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:297)
at android.widget.TextView.setText(TextView.java:2746)
at android.widget.TextView.setText(TextView.java:2626)
at android.widget.EditText.setText(EditText.java:82)
at android.widget.TextView.<init>(TextView.java:924)
at android.widget.EditText.<init>(EditText.java:57)
at android.widget.EditText.<init>(EditText.java:53)
at android.preference.EditTextPreference.<init>(EditTextPreference.java:56)
... 26 more
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Abhinav
  • 38,516
  • 9
  • 41
  • 49
  • Seems like a bug in HTC firmware. Once i've got a similar one with Samsung, in `EditText` on `PopupWindow` (That bug didn't reproduce on HTC and emulators). – ernazm Mar 31 '11 at 13:48
  • May be an obvious question, but what are the different API levels concerned here? – RivieraKid Mar 31 '11 at 14:00
  • Just testing on Android 2.2 (API Level 8) right now. Same code works on >2.3 in the emulator. – Abhinav Mar 31 '11 at 14:04
  • Is "@style/HomeInput" yours or a standard Android style? If yours, can you post the details of the style also? Another (possibly) stupid question - do you happen to have a class in your app called EditText? The `java.lang.reflect.InvocationTargetException` error can mean that the VM is [unable](http://java.ittoolbox.com/groups/technical-functional/javaee-l/how-to-resolve-the-errorjavalangreflectinvocationtargetexception-1710507) to instantiate the correct class. – RivieraKid Mar 31 '11 at 15:32
  • Also, take a look at this [question](http://stackoverflow.com/questions/2417341/invocationtargetexception-on-inflating-an-xml-android) – RivieraKid Mar 31 '11 at 15:33
  • @RiveraKid: Thanks. There is no class in my app called EditText. Using whatever Android provides. Error comes when the activity is inflated from the XML. @style/HomeInput is my own style. Adding it to the question. – Abhinav Mar 31 '11 at 18:39

3 Answers3

3

I finally sorted it! To start, this was my setup:

UI thread -> AsyncTask.doInBackground -> inflate

This worked perfectly fine in simulator from 1.6 to 2.3 and on other handsets (LG and Motorola), however it would blow up on HTC (Desire and Wildfire). The actual error was InflateException "Error inflating class", caused by InvocationTargetException, caused by RuntimeException "Can't create handler inside thread that has not called Looper.prepare()".

I changed this set up to

UI thread -> create Handler
UI thread -> AsyncTask.doInBackground -> Handler.sendMessage
Handler.handleMessage() -> inflate

This resulted in exactly same error. This was weird, as the code was executed from inside the handler created on the UI thread (see the lines with ** around it).

android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at com.ookl.ookllite.view.Search.createLayout(Search.java:57)
    at com.ookl.ookllite.view.Search.<init>(Search.java:44)
    at com.ookl.ookllite.OOKL.setupScreens(OOKL.java:1232)
    at com.ookl.ookllite.OOKL.access$0(OOKL.java:1199)
    **at com.ookl.ookllite.OOKL$1.handleMessage(OOKL.java:160)**
    at com.ookl.ookllite.OOKL$SetupAppTask.doInBackground(OOKL.java:281)
    at com.ookl.ookllite.OOKL$SetupAppTask.doInBackground(OOKL.java:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:185)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
    at java.lang.Thread.run(Thread.java:1102)
Caused by: java.lang.reflect.InvocationTargetException
...

Finally, what did the trick was this:

UI thread -> create Runnable
UI thread -> create Handle
UI thread -> AsyncTask.doInBackground -> Handler.post(Runnable)
Runnable.run -> inflate

And this was it - it now worked on both Desire and Wildfire.

Not sure if you're having the same problem, but hopefully this will help you.

Aleks G
  • 56,435
  • 29
  • 168
  • 265
  • Thanks Aleks G for the response. My situation is a little different. The app blows up on just opening the screen. Am not using an AsyncTask anywhere. Just the normal flow with setContentView. The app works fine on a Desire and Wildfire but crashes only on a Desire HD. I got the screen to be displayed by disabling some EditText fields but the app still crashes on tapping the EditText - basically when the EditText gets focus. – Abhinav May 06 '11 at 14:59
  • Just a thought: what if you remove the EditText from the xml and create the EditText and add it to the layout at runtime? – Aleks G May 07 '11 at 19:01
  • That would be too tedious. Would have to create alternate layouts for every place where I have EditText and set layout params. Along with that, will have to take care of orientation and stuff. – Abhinav May 08 '11 at 07:11
3

Unless your phone is completely broken, other applications are able to display EditText widgets. Hence, the problem in HTC's firmware is triggered by the definition of your EditText widget. Remove attributes one at a time from the widget or style until it works -- the last one you removed was your problem.

I would start with android:text="", since it is superfluous at best and could possibly be the source of your problem. These also seem like likely candidates:

  • android:maxLines="1"
  • android:capitalize="none"
  • android:inputType="text"

In the end, this is a bug in HTC's firmware -- it's merely a matter of trying to work around whatever the bug is.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks! I tried out a completely basic version of an EditText. Without styles or any of the above fields and the app still crashed. Even more weird is that I have a Settings screen with an EditTextPreference which crashes with almost the same kind of error message. Posting it with the answer. – Abhinav May 09 '11 at 09:48
  • @Abhinav: I stand by my original statement -- unless every app on your device is crashing, then *some*, perhaps *most*, apps are able to successfully display `EditText` widgets. Hence, there's something peculiar about your app. If it is not in the individual widget declaration, then it is somewhere else. Put your own code aside for a bit. Grab https://github.com/commonsguy/cw-android/tree/master/Basic/Field and confirm if it runs. If it does, then you need to start figuring out what is different about your app's setup. If it crashes, your phone is busted. :-) – CommonsWare May 09 '11 at 09:55
  • I wish I had a Desire HD. :( Crash reports are from Desire HD users and many people had this problem. Am trying hard to get the phone from somewhere. I guess will be able to figure out what's wrong then only. Thanks! – Abhinav May 09 '11 at 10:30
  • @Abhinav: Ah, sorry, based on the way you were phrasing things in the question, I assumed you had the device. DeviceAnywhere may have a Desire HD. – CommonsWare May 09 '11 at 10:31
  • Finally got the error! Got hold of a Desire HD phone through a friend and kept removing stuff until it worked. It was a few stray lines of code in my Application class which I had no idea about and that kept crashing the EditText. Was overriding getSystemService and returning null. Probably came in while I was trying to implement a cache library. Still no idea how it was there and why it worked on other phones! Thanks for the help. – Abhinav May 11 '11 at 01:08
0

This might be included in your style which is not shown, but most of the time you need to specify:

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
sgarman
  • 6,152
  • 5
  • 40
  • 44