我收到此错误:对于非静态字段,方法或属性'Android.App.FragmentManager.BeginTransaction()'在行中需要对象引用:FragmentTransaction transaction = FragmentManager.BeginTransaction();
void mEditar_Click (object sender, EventArgs e )
{
FragmentTransaction transaction = FragmentManager.BeginTransaction();
dialog_Editar_produto dialog_editar = new dialog_Editar_produto ();
dialog_editar.Show (transaction, "dialog fragment");
dialog_editar.mOnEditarComplete += dialog_editar_mOnEditarComplete;
}
我该怎么办?
答案 0 :(得分:0)
该错误消息表明BeginTransaction不是FragmentManager类的静态方法。 尝试访问班级中的FragmentManager对象。
试试这个:
FragmentTransaction transaction = this.FragmentManager.BeginTransaction();
答案 1 :(得分:0)
使用此代码:
FragmentManager fragmentManager = getFragmentManager()
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
了解更多信息 http://developer.android.com/guide/components/fragments.html