没有为show(ActionBar,String)方法找到合适的方法DialogFragment.show(FragmentTransaction,String)不适用

时间:2015-04-27 10:46:11

标签: java android

获取

window.B = require './B.coffee'
class A extends window.B

window.instanceA = new A
window.A = A

尝试创建自定义对话框时,在Error:(192, 23) error: no suitable method found for show(ActionBar,String) method DialogFragment.show(FragmentTransaction,String) is not applicable (actual argument ActionBar cannot be converted to FragmentTransaction by method invocation conversion) method DialogFragment.show(FragmentManager,String) is not applicable (actual argument ActionBar cannot be converted to FragmentManager by method invocation conversion) 此代码中收到错误。

这是我的简要代码:

dialog.show(getSupportActionBar(), "dialog");

请帮我解决这个问题。谢谢你......

2 个答案:

答案 0 :(得分:1)

使用FragmentManager

解决
FragmentManager fm;
fm= getFragmentManager();
CustomDialogFragment dialog = new CustomDialogFragment();
dialog.show(fm , "dialog");

答案 1 :(得分:0)

DialogFragment fragment = new DialogFragment();
fragment.show(getSupportFragmentManager(), "dialog");