Android - bindService at fragment -
I have an activity class and on this on As you can understand that I am compulsive and engaged in any service. The thing is now that I want to use the piece instead of the activity. To do this, I have changed this paraguse code to - And it feels good. But the thing with which I have a problem is the bind part on But Eclipse tells me an error - The service is looking like this - Why can not I bind this section? Maybe I need to get something? GetActivity Code Thnks for any assistance Thanks to Raghunandan - this is the solution - use it needs onResume section I used the next code -
@ Override Protected Zero (Regenerate) {super.onResume (); Bind service (new intent (main activity., IMS service class), connection, context. }
onPause I used the next code -
place the protected zeros on @Override () {unbindService (mConnection); super.onPause (); }
Prevent protected zeros on @override () {getActivity () UnbindService (mConnection); super.onPause (); }
onResume , I have tried the next code -
@ Override protected Resume at zero () {super.onResume (); Bind service (new intent (getActivity (), IMService.class), mConnection, Context.BIND_AUTO_CREATE); }
The method is mandatory for bindService (intent, service connection, difference) type MainFragment
& lt; Service Android: name = "com.example.test.services.IMService" & gt; & Lt; / Services & gt;
getActivity (). BindService (new intent (getActivity (), IMService.class), mConnection, Context.BIND_AUTO_CREATE);
getActivity.bindService (parameter )
Comments
Post a Comment