Can anyone help me how to test a broadcast receiver in my activity? is there a way to push intents to a activity from a test class?
BroadcastReceiver usbReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (intent.getExtras().getBoolean("connected")) {
Toast.makeText(getApplicationContext(), R.string.usb_connected_status, Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), R.string.usb_disconnected_status, Toast.LENGTH_LONG).show();
}
}
};
Aucun commentaire:
Enregistrer un commentaire