activity中 向service传值
与ativity互相传值类似
在activity中
Intent regIntent = new Intent(this, ChatService.class);
然后再service中的onStart函数中获取该值
student_id=intent.getStringExtra("student_id");
当然写到这里还是不能传的,不然会报错!!!
我们需要在Mainfeist文件中注册这个service
销毁Service写在activity的onDestroy方法里: