In my menu I have some items. Home is an item of it that I want to be root of my application and whenever user clicks on it, Android clear stack and then come back to main s
I have tried Intent.FLAG_ACTIVITY_CLEAR_TOP But haven't got proper solution so finally this helps me
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
ComponentName cn = intent.getComponent();
Intent mainIntent = IntentCompat.makeRestartActivityTask(cn);
startActivity(mainIntent);
This clears all the stack and run only LoginActivity