how to start service from fragments

后端 未结 1 825
抹茶落季
抹茶落季 2021-01-31 08:38

I want to start service from fragment from a list view item. I am trying to call service with:

startService(new Intent(getActivity(),myPlayService.class));


        
相关标签:
1条回答
  • 2021-01-31 09:12

    Replace

    startService(new Intent(getActivity(),myPlayService.class));

    with

    getActivity().startService(new Intent(getActivity(),myPlayService.class));

    0 讨论(0)
提交回复
热议问题