I received this crash report in Google Play Console which I myself never experience.
java.lang.IllegalArgumentException:
at android.widget.ListPopupWindow.setHeight (ListPopupWindow.java:541)
at android.widget.AutoCompleteTextView.setDropDownHeight (AutoCompleteTextView.java:414)
at .MyEditText.showDropDown (MyEditText.java:44)
at android.widget.AutoCompleteTextView.updateDropDownForFilter (AutoCompleteTextView.java:1086)
at android.widget.AutoCompleteTextView.onFilterComplete (AutoCompleteTextView.java:1068)
at android.widget.Filter$ResultsHandler.handleMessage (Filter.java:285)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:172)
at android.app.ActivityThread.main (ActivityThread.java:6637)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
I am using this showDropDown
method to leave the space of 50 dp from the bottom of screen so that the drop down will not cover my Admob ads on the bottom.
public void showDropDown() {
Rect displayFrame = new Rect();
getWindowVisibleDisplayFrame(displayFrame);
int[] locationOnScreen = new int[2];
getLocationOnScreen(locationOnScreen);
int bottom = locationOnScreen[1] + getHeight();
int availableHeightBelow = displayFrame.bottom - bottom;
Resources r = getResources();
int bannerHeight = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, r.getDisplayMetrics()));
int downHeight = availableHeightBelow - bannerHeight;
setDropDownHeight(downHeight);
super.showDropDown();
}
From Google Play Console, this crash only affects Mi A1 and Mate 10 Pro running Android 8.0. I do not experience this crash on emulator running Android 8.0.
This is the desired effect: