我的错误场景,仅供参考:
如果是在xml里绑定的点击事件
android:onClick="startService"
哪在activity的代码里
startService()方法一定要是puulic的并且方法有View 参数
//启动服务
public void startService(View view) {
startService(new Intent(this, MyService.class));
}
我的错误场景,仅供参考:
如果是在xml里绑定的点击事件
android:onClick="startService"
哪在activity的代码里
startService()方法一定要是puulic的并且方法有View 参数
//启动服务
public void startService(View view) {
startService(new Intent(this, MyService.class));
}