0
public class Thread2 implements Runnable{

    @Override
    public void run() {
        synchronized(this){
            Log.d("TAG","into Thread2 runnable");
            Intent in=new Intent(MyService.this,Display.class);     
            in.putExtra("Integer", 1234);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(in);
        }

在将静态数据发送到意图之前,需要停止服务......怎么办?提前致谢

4

2 回答 2

1

服务有方法

停止自我();

于 2013-09-24T11:14:34.933 回答
1

您可以使用以下方法停止活动中的服务:

stopService(new Intent(this, MyService.class));
于 2013-09-24T11:20:09.627 回答