在 setTargetFragment 中获取错误
Getting error in setTargetFragment
我有一个名为 A 的 class 扩展片段,我在其中设置片段 B(B 扩展 DialogFragment)
B b = B.newInstance();
b.setTargetFragment(this,1111);
我面临的问题是我在 this 下看到一条波浪线,它表示第一个参数错误。发现 com.xyz.Afragment 而期待 android.app.fragment。如何实现?
The problem I am facing is that I am getting the squiggly line under
this which says wrong 1st argument. Found com.xyz.Afragment while
expecting android.app.fragment. How to make this work?
如果 this
是 Fragment
或 DialogFragment
的子类,请确保所有导入都来自同一个包。例如。全部来自 support library
,因为本机包已弃用。
我有一个名为 A 的 class 扩展片段,我在其中设置片段 B(B 扩展 DialogFragment)
B b = B.newInstance();
b.setTargetFragment(this,1111);
我面临的问题是我在 this 下看到一条波浪线,它表示第一个参数错误。发现 com.xyz.Afragment 而期待 android.app.fragment。如何实现?
The problem I am facing is that I am getting the squiggly line under this which says wrong 1st argument. Found com.xyz.Afragment while expecting android.app.fragment. How to make this work?
如果 this
是 Fragment
或 DialogFragment
的子类,请确保所有导入都来自同一个包。例如。全部来自 support library
,因为本机包已弃用。