【发布时间】:2014-10-26 20:30:48
【问题描述】:
我正在尝试调用这个函数public void arrowClick()
在我的主要片段public class CounterMain extends Fragment implements View.OnClickListener{
片段扩展android.support.v4.app.Fragment
我想从另一个 Custmoe Dialog 片段调用这个函数
public class CustmoeDialog extends DialogFragment {
我试过((CounterMain)getActivity()).arrowClick();
但我不能使用它上面写着android.support.v4.app.Fragment cannot be cast to my.example.CounterMain
和
CounterMain x = new CounterMain(); x.arrowClick();
当我调用它时,它会让我的应用停止工作
有什么帮助吗?
【问题讨论】:
标签: android android-activity fragment overflow