58.9 Launching the Service
Edit the MainActivity.java file and modify the buttonClick() method to launch the MyService service:
public void buttonClick(View view)
{
Intent intent = new Intent(this, MyService.class);
startService(intent);
}
All that the buttonClick() method does is create an intent object for the new service and then start it running.