public static void edit(String vid, String vnames, String rowid) {
// TODO Auto-generated method stub
Fragment fragment = new AddVendor();
bundle = new Bundle();
bundle.putString("vendorid", vid);
bundle.putString("rowid", rowid);
bundle.putBoolean("main", true);
Log.e("2", "" + vid);
Log.e("22", "" + rowid);
Log.e("33", "" + vnames);
fragment.setArguments(bundle);
FragmentManager fragmentManager=getSupportFragmentManager();
// FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragment, CommonUtil.CLASS_NAME)
.commit();
//add();
}
fragmentmanager显示静态方法不支持错误。如何调用片段?
答案 0 :(得分:0)
如何在android中的片段类中调用静态方法?
您可以通过edit
类型FragmentManager
方法中再添加一个参数来实现此目的:
public static void edit(String vid, String vnames,
String rowid,FragmentManager fragmentManager) {
// use fragmentManager for transaction
....
}