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

RemoteServiceController

public class RemoteServiceController extends android.app.Activity

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

Demo

App/Service/Remote Service Controller

Source files

src/com/google/android/samples/app/RemoteServiceController.java The Remote Service Controller implementation
src/com/google/android/samples/app/RemoteService.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.remote_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);