1

我想将一个变量从 IntentService 传递给 Service。

假设我有: MyService.java 和 MyIntentService.java

public class MyService extends Service {

public static String myString = "";

}

public class MyIntentService extends IntentService {

protected void onHandleIntent(Intent intent)
{
MyService.myString = "My New String Value";
}

}

它是这样工作的吗?还是我应该使用 Intent.putextra(...) 方法?

4

0 回答 0