求助,这个错误的原因是什么?
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity {
Intent intent1;
Intent intent2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click(View v){
switch(v.getId()){
case R.id.startS:
intent1=new Intent(MainActivity.this, myService.class);
startService(intent1);
break;
case R.id.stopS:
stopService(intent1);
break;
case R.id.bind:
intent2=new Intent(MainActivity.this, myService2.class);
bindService(intent2, null, Service.BIND_AUTO_CREATE);
break;
case R.id.unbind:
unbindService(null);
break;
}
}
}