Why does this work:
sendBroadcast(MyUtil.configMyIntent(
new Intent(),
ActionType.DATE,
new Date().toString()));
with:
public static Intent configMyIntent(Intent intent, ActionType actionType, String content){
intent.setAction("myCustomBroadcastIntentAction");
intent.putExtra("actionType",actiontype);
intent.putExtra("content", content);
return intent;
}
But when using a subclass:
CustomIntent intent = new CustomIntent(ActionType.DATE, new Date().toString());
sendBroadcast(intent);
with
public class CustomIntent extends Intent {
public CustomIntent(ActionType actionType, String content) {
super();
this.setAction("myCustomBroadcastIntentAction");
this.putExtra("actionType",actionType);
this.putExtra("content", content);
}
}
the extras are not added to the intent and are null when receiving in the BroadcastReceiver?