This is the code in my Activity. Initiate an Intent, then a Connection, right?
hello_service = new Intent(this
To connect a service to an activity, all you need to write in a ServiceConnection implementation is :
@Override
public void onServiceDisconnected(ComponentName name) {
mServiceBound = false;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
MyBinder myBinder = (MyBinder) service;
mBoundService = myBinder.getService();
mServiceBound = true;
}
Here mBoundService is an object of your bound service. Have a look at this Bound Service Example.