に送信される にString
エクストラを渡し、次のようにフェッチしています。Intent
BroadCastReceiver
public void onReceive(Context context, Intent intent) {
if (intent.hasExtra("type")){
Log.i("Listener", ":"+intent.getStringExtra("type")+":");
if (intent.getStringExtra("type") == "start"){
Log.i("Listener", "start");
}
if (intent.getStringExtra("type") == "end"){
Log.i("Listener", "end");
}
}
}//end method
このコードにより、次の出力が得られます (予想どおり)。
07-22 10:41:00.038: I/Listener(28678): :start:
type
2 番目の if ステートメントは、明らかに正しく設定されていても一致しないことは予想外です。私はこれを数回見ましたが、本当に迷惑です。私が知る限り、この動作は奇妙に思えますが、私はこれに正しい方法で取り組んでいます。
誰でもアイデアはありますか?