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

LocalServiceBinding

public class LocalServiceBinding extends android.app.Activity

Example of binding and unbinding to the {@link LocalService}. 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/Local Service Binding

Source files

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

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

        super.onCreate(icicle);

        setContentView(R.layout.local_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);