android:name = "xper.example.ORDERED_BROADCAST_INTENT_TWO"/>
Their respective onReceive() methods
are defined as follows // OrderedBroadcastReceiverOne.onReceive() public void onReceive(Context context, Intent intent)
{
System.out.println("One: " + intent
System.out.println("\tgetResultCode() => " + getResultCode());
System.out.println("\tgetResultData() => " + getResultData()); setResultCode(getResultCode() + 1); setResultData(getResultData() + ", One
Bundle extras = getResultExtras(true); extras.putString("One.value", "One setResultExtras(extras);
System.out.println("One Done
}
// OrderedBroadcastReceiverTwoA.onReceive() public void onReceive(Context context, Intent intent)
{
System.out.println("TwoA");
System.out.println(intent);
System.out.println("\tgetResultCode() => " + getResultCode());
System.out.println("\tgetResultData() => " + getResultData()); setResultCode(getResultCode() + 20); setResultData(getResultData() + ", TwoA");
Bundle extras = getResultExtras(true); extras.putString("TwoA.value", "TwoA"); setResultExtras(extras); if ("xper.example.ORDERED_BROADCAST_INTENT_TWO".equals(intent.getAction()))
{ abortBroadcast();
}
System.out.println("TwoA done
}
System.out.println("ResultReceiver");
System.out.println(intent);
System.out.println("\tgetResultCode() => " + getResultCode());
System.out.println("\tgetResultData() => " + getResultData());
Bundle extras = getResultExtras(true);
System.out.println("\tBegin Extras for (String key : extras.keySet())
{
System.out.print("\t\t");
System.out.print(key);
System.out.print("\t=> ");
System.out.println(extras.get(key));
}
System.out.println("\tEnd Extras
System.out.println("ResultReceiver done
}
Share with your friends: