fragment can not be directly sendBroadcast ();. getActivity () sendBroadcast (), then the error.
How to achieve fragment and service broadcasting?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Service to try to bind the way, have not tried broadcasting, broadcasting feeling relatively inefficient
Reply:
fragment is to be among the parasite in some Activity, if you want to send a broadcast Fragment inside, it will only send it in the Activity on the inside, getActivity (). sendBroadcast () how the error? Look up questions based on exceptions, or posted
Reply:
Broadcast inefficient it? I do not know, I generally use the broadcast. Communication with the Service generally what method you use?
Reply:
Activity activity = getAcitivity ();
activity.sendBroadcast (intent);
Is so written, reported a null pointer error seems ~
Now the code changed, switch interfaces, run by ~
Like online tutorials getActivity () are so used:. GetActivity () findViewById () ...
Reply:
I'm sorry, these days not on CSDN, solved the problem then I do not grumble crooked
No comments:
Post a Comment