I have four activity, i.e. A, B, C and D. A launches B, B launches C, C launches D. When C is launching D, I want to destroy the activity B depending on the situation(logic for that will remain in activity C) so that when I go back From D, it will follow D->C->A path. So I want to destroy activity B from C. How it is possible?
finish Activity B when you are calling Activity C depends on your logic. For example
if(true){
Intent in = new Intent(B.this,c.class);
startActivity(c);
}
else
{
Intent in = new Intent(B.this,c.class);
startActivity(c);
finish();
}