1、在Fragment中OnActivityResult()中接收Activity中返回的值
返回值必须这么写:resultCode == getActivity().RESULT_OK,若写为resultCode == RESULT_OK会报错
2、设置监听器时,通常都要用加载了的视图来进行findViewById(),否则也会报错
3、在fragment里运行runOnUiThread,不能写为runOnUiThread(new Runnable(){});而应写为
getActivity().runOnUiThread(new Runnable()
4、Fragment中获取Activity的Context时只需要getActivity()或者getContext()即可.
5.得到控件实例
mview = inflater.inflate(R.layout.fragment_home, container, false);
tv_desc = mview.findViewById(R.id.tv_desc); return mview;