wzgiceman / RxjavaRetrofitDemo-master

Retrofit+Rxjava+okhttp终极封装(Gson方案)
http://blog.csdn.net/column/details/13297.html
MIT License
1.06k stars 290 forks source link

在Fragment中如何获取RxAppCompatActivity #33

Open GospelHW opened 7 years ago

GospelHW commented 7 years ago

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { SubjectPostApi postEntity = new SubjectPostApi(simpleOnNextListener, (RxAppCompatActivity) getActivity()); }

GospelHW commented 7 years ago

default 你说的这种方式不行啊? java.lang.ClassCastException: cn.ccccltd.hntsmview.MainActivity cannot be cast to com.trello.rxlifecycle.components.support.RxAppCompatActivity

是我哪里写错了吗?