since I got the first device with Android 11
(it's POS hardware, i.e. cash registers; manufacturers are slow to upgrade android versions - nothing to discuss here and now ;-)
I keep getting tons of messages like
E/ViewConfiguration: Tried to access UI constants from a non-visual Context:android.app.Presentation$1@f11ffd8UI constants, such as display metrics or window metrics, must be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen
java.lang.IllegalArgumentException: Tried to access UI constants from a non-visual Context:android.app.Presentation$1@f11ffd8
at android.view.ViewConfiguration.get(ViewConfiguration.java:510)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:762)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:721)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:399)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109)
at android.app.Dialog.show(Dialog.java:340)
at android.app.Presentation.show(Presentation.java:257)
at xxx.xxx.xxx.xxx.xxx.xxx.CustomerDisplayPresentation.show(CustomerDisplayPresentation.java:134)
Now, my CustomerDisplayPresentation
I made the Constructor:
public CustomerDisplayPresentation(Activity outerContext, Display display) {
super(outerContext, display);
}
so it's 100% guaranteed the outerContext is always an Activity (and not an app context). Also tried storing the outerContext and using it for all getLayoutInflater() and such...
Still I keep getting these messages, spamming the logcat.
What can I do about that ?
(I'm a bit afraid that android.app.Presentation
is such a rarely used API, that just nobody noticed that this is a flaw in Android itself? Google provides no meaningful hits whatsoever)