I am trying to understand the tutorial on the android developer web site: http://developer.android.com/reference/android/app/Service.html
I understand most of it expect where its uses this bit code in the "Remote Messenger Service Sample" section of the tutorial ...
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className,
IBinder service) {
...
Toast.makeText(Binding.this, R.string.remote_service_connected,
Toast.LENGTH_SHORT).show();
}
... where is Binding.this
defined? Is that a typo? There are several other places in the tutorial where Binding.this
is used but there is no explanation about what Binding
is or how it gets initialized.
Binding.this
gets used here like so ...
void doBindService() {
// Establish a connection with the service. We use an explicit
// class name because there is no reason to be able to let other
// applications replace our component.
bindService(new Intent(Binding.this,
MessengerService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
mCallbackText.setText("Binding.");
}
Any help is appreciated thanks!