アクティビティでは、このような値 paramVal を渡しました
Intent srv = new Intent(this, TestService.class);
startService(srv);
//Intent intent =new Intent("com.example.firstapplication.STARTACTIVITY");
//intent.putExtra("myFirstKey", paramVal);
//intent.putExtra("myFirstKey", paramVal);
Bundle bundle = new Bundle();
bundle.putCharSequence("myFirstKey", paramVal);
intent.putExtras(bundle);
サービスでは、このような値を取得しています
@Override
public void onStart(Intent intent, int startId) {
// TODO Auto-generated method stub
super.onStart(intent, startId);
Bundle bundle = intent.getExtras();
data = (String) bundle.getCharSequence("myFirstKey");
System.out.println("data checking"+data);
}
しかし、行のヌルポインター例外が発生しています
data = (String) bundle.getCharSequence("myFirstKey");
使用中
サービスのどこかで onstart メソッドを呼び出す必要がありますか。どこが問題なのか教えてください??