Consider using Aas a dispatcher. When you want to start Bfrom Dand complete Cin this process, do this in D:
Intent intent = new Intent(this, A.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("startB", true);
startActivity(intent);
A.onNewIntent() :
@Override
protected void onNewIntent(Intent intent) {
if (intent.hasExtra("startB")) {
startActivity(new Intent(this, B.class));
}
}