Skip to content

Tried to access the API:LayoutInflater which needs to have proper configuration from a non-UI Context #555

Open
@kkoshin

Description

@kkoshin

https://github.com/ponnamkarthik/FlutterToast/blob/0edb4c7adf86f7245d99ee6ef12987a06653304d/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt#L49C36-L49C93

Tried to access the API:LayoutInflater which needs to have proper configuration from a non-UI Context. The API:LayoutInflater needs a proper configuration. Use UI contexts such as an activity or a context created via createWindowContext(Display, int, Bundle) or  createConfigurationContext(Configuration) with a proper configuration.
at android.os.StrictMode.assertConfigurationContext(StrictMode.java:2430)
	at android.view.LayoutInflater.<init>(LayoutInflater.java:266)
	at com.android.internal.policy.PhoneLayoutInflater.<init>(PhoneLayoutInflater.java:44)
	at android.app.SystemServiceRegistry$33.createService(SystemServiceRegistry.java:576)
	at android.app.SystemServiceRegistry$33.createService(SystemServiceRegistry.java:573)
	at android.app.SystemServiceRegistry$CachedServiceFetcher.getService(SystemServiceRegistry.java:1993)
	at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:1666)
	at android.app.ContextImpl.getSystemService(ContextImpl.java:2264)
	at android.content.ContextWrapper.getSystemService(ContextWrapper.java:944)
	at io.github.ponnamkarthik.toast.fluttertoast.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.kt:49)
	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
	at android.os.Handler.handleCallback(Handler.java:958)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:257)
	at android.os.Looper.loop(Looper.java:368)
	at android.app.ActivityThread.main(ActivityThread.java:8839)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions