FileDocCategorySizeDatePackage
RemoteServiceBinding.javaAPI DocGoogle Android v1.5 Example6526Sun Nov 11 13:01:04 GMT 2007com.google.android.samples.app

RemoteServiceBinding

public class RemoteServiceBinding extends android.app.Activity

Example of binding and unbinding to the {@link RemoteService}. This demonstrates the implementation of a service which the client will bind to, receiving an object through which it can communicate with the service.

Demo

App/Service/Remote Service Binding

Source files

src/com/google/android/samples/app/RemoteServiceBinding.java The Remote Service Binding implementation
src/com/google/android/samples/app/RemoteService.java The implementation of the service itself
/res/any/layout/local_service_binding.xml Defines contents of the screen

Fields Summary
IRemoteService
mService
android.widget.Button
mKillButton
private boolean
mIsBound
private android.content.ServiceConnection
mConnection
private android.view.View.OnClickListener
mBindListener
private android.view.View.OnClickListener
mUnbindListener
private android.view.View.OnClickListener
mKillListener
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)


    
       
    
        super.onCreate(icicle);

        setContentView(R.layout.remote_service_binding);

        // Watch for button clicks.
        Button button = (Button)findViewById(R.id.bind);
        button.setOnClickListener(mBindListener);
        button = (Button)findViewById(R.id.unbind);
        button.setOnClickListener(mUnbindListener);
        mKillButton = (Button)findViewById(R.id.kill);
        mKillButton.setOnClickListener(mKillListener);
        mKillButton.setEnabled(false);