Using 3rd party android Fragment in flutter

390 views
Skip to first unread message

Korneel Dumon

unread,
Aug 8, 2019, 4:40:30 AM8/8/19
to Flutter Development (flutter-dev)
Hi,

I'm trying to include an android Fragment in my flutter app. I found some great tutorials about include native android/ios views (see link below). I get to the point where I can include an android TextView in my app. But when I use my 3rd party Fragment, I use onCreateView(). It spits out a lot of errors at runtime (see below) and renders some of the Fragment's UI, but the layout is messed up. Does anyone have experience using android Fragments like this and have any idea what the issue is?

...
Caused by: android.view.InflateException: Binary XML file line #58: Binary XML file line #58: Error inflating class androidx.appcompat.widget.SearchView
...
Caused by: android.view.InflateException: Binary XML file line #93: Binary XML file line #93: Error inflating class <unknown>
...
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0301fb a=-1}
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList ...


The way I implemented my PlatformView is something like this:

myFragment = new MyFragment() {
   
@Override
   
public Context getContext() { // hack so the Fragment continues to have a context
       
return context; // this is the context I get from PlatformViewFactory
   
}
};
myView
= visioGlobeFragment.onCreateView(LayoutInflater.from(context), null, null);

Reply all
Reply to author
Forward
0 new messages