4

We have an app that's been working for years. So it does NOT use all the latest and greatest features.

We've found that on current versions of Android, IF there is text in an EditText control AND you long-touch it - the app crashes with:

11-13 14:26:20.720: E/AndroidRuntime(1253): FATAL EXCEPTION: main
11-13 14:26:20.720: E/AndroidRuntime(1253): java.lang.IllegalStateException: ActionBarContextView can only be used with android:layout_width="match_parent" (or fill_parent)
11-13 14:26:20.720: E/AndroidRuntime(1253):     at com.android.internal.widget.ActionBarContextView.onMeasure(ActionBarContextView.java:325)
11-13 14:26:20.720: E/AndroidRuntime(1253):     at android.view.View.measure(View.java:12603)
11-13 14:26:20.720: E/AndroidRuntime(1253):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
11-13 14:26:20.720: E/AndroidRuntime(1253):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
11-13 14:26:20.720: E/AndroidRuntime(1253):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)

I know that we have no references to an ActionBarContextView anywhere in our xml or java files, nor do we use any Themes. These EditText controls are in Activities, not Dialogs.

We do have a Custom layout as our root layout, and the crash stacktrace does eventually get back to one if it's methods:

  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final int count = getChildCount();

    for (int i = 0; i < count; i++) {
      final View child = getChildAt(i);
      measureChild(child, widthMeasureSpec, heightMeasureSpec);
    }
    setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
  }

Any ideas where to look, or what to change?

CasaDelGato
  • 1,263
  • 1
  • 12
  • 29
  • Ok, since it is apparently unfixable, we made a workaround. We made a trivial subclass of EditText, and call setLongClickable(false) in all the constructors. Then we modified all our layouts to use that subclass. This prevents it from crashing on a long touch - and is easy to undo later if we ever come up with a real fix. – CasaDelGato Nov 20 '13 at 16:00
  • Do post your answer and close the question if you got solution. – GrIsHu Aug 11 '14 at 09:01
  • No fix ever found. And even with the workaround I posted, it still happens occasionally - just less often. And since I no longer work for that company, I'll never know if they even find a fix. – CasaDelGato Aug 11 '14 at 17:18

0 Answers0