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

LocalServiceController

public class LocalServiceController extends android.app.Activity

Example of explicitly starting and stopping the {@link LocalService}. This demonstrates the implementation of a service that runs in the same process as the rest of the application, which is explicitly started and stopped as desired.

Demo

App/Service/Local Service Controller

Source files

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

Fields Summary
private android.view.View.OnClickListener
mStartListener
private android.view.View.OnClickListener
mStopListener
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        setContentView(R.layout.local_service_controller);

        // Watch for button clicks.
        Button button = (Button)findViewById(R.id.start);
        button.setOnClickListener(mStartListener);
        button = (Button)findViewById(R.id.stop);
        button.setOnClickListener(mStopListener);