I have Activity and Fragment.
I can access Activity using method getActivity(); But it's instance of FragmentActivity. How can I get instance of my Activity?
I tried it: ((MyActivity) getActivity())
It works but I think it's not the best way to do it. Is there more good ways?
Following ways are there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.