I developed an application that receives a broadcast, and then starts Activity, where it Activityasks ContentProvider
which displays information from DNS in real time.
I would like to be able to shuffle this so that instead of going:
BroadcastReceiver.onReceive() {
Intent intent = new Intent(...);
intent.setData(...);
context.startActivity(intent);
}
Activity.onCreate() {
String value = intent.getData();
Cursor = ContentProvider.query(search);
...
setContentView(...);
}
he's coming:
BroadcastReceiver.onReceive() {
Cursor = ContentProvider.query(...);
if (cursor != null) {
Intent intent = new Intent(...);
getContext().startActivity(intent);
}
}
Activity.onCreate() {
setContentView(...);
}
i.e. if it query()does not return data, I want to skip the start
Activityand allow the broadcast to pass as usual.
If it query()returns data, I want to Cursor
Activity, so I do not need to go and request data again.
In turn, it Activityhas its own user interface, to which the user must respond.
Is it possible?