FileDocCategorySizeDatePackage
LocalServiceBinding.javaAPI DocAndroid 1.5 API4071Wed May 06 22:41:08 BST 2009com.example.android.apis.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.

Fields Summary
private boolean
mIsBound
private LocalService
mBoundService
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 savedInstanceState)

        super.onCreate(savedInstanceState);

        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);