android 在service中用onStart()获取activity传递的值,能接受到这个值,但是不能应用于全局变量呢?解决方法

android 在service中用onStart()获取activity传递的值,能接受到这个值,但是不能应用于全局变量呢?在activi

android 在service中用onStart()获取activity传递的值,能接受到这个值,但是不能应用于全局变量呢?
在activity中:

Java code
 Intent service=new Intent(CarActivity.this, GetLocation.class);// 设置服务将要跳转 service.putExtra("CAR_ID", userid);// 将userid传递给CAR_ID

在service中:
Java code
    public void onStart(Intent intent, int startId) {        // TODO Auto-generated method stub        super.onStart(intent, startId);         carID= intent.getStringExtra("CAR_ID");        System.out.println("Get args from intent:" + carID);    }

这样,在logcat中能正常输出,但是,如果将System.out.println("Get args from intent:" + carID);放在其他地方,打印Get args from intent: null
大侠们帮忙啊。。。。。

[解决办法]
请说清楚点。
[解决办法]
不影响你使用不就行了吗
[解决办法]
探讨

引用:

请说清楚点。

activity 向 service传值,在onStart(Intent intent, int startId){}中接收这个值,但是接收到这个值,不能应用于全局变量,只能在onStart()方法中用。