how to start service from fragments

后端 未结 1 847
抹茶落季
抹茶落季 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)
提交回复
热议问题