In my app i have an Activity and fragment, from fragment on button click im doing an Implicit Intent, opening another app. When another app opens if i do device back press, both the apps are closing. I want my app should resume. Please any guide me what im going wrong. Thanks
im doing intent like this
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.basic");
     if (launchIntent != null) {
         launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(launchIntent);
     } else {
        Toast.makeText(getContext(), "Package not found", Toast.LENGTH_SHORT).show();
     }
my Activity onBackPressed
 @Override
 public void onBackPressed() {
       FragmentManager fm = getSupportFragmentManager();
       int backStackEntryCount = fm.getBackStackEntryCount();
       if(backStackEntryCount>1) {
            super.onBackPressed();
        }
 }
 
    