jump From One Activity to another Activity With No History - Android android.app

Android examples for android.app:Activity Navigation

Description

jump From One Activity to another Activity With No History

Demo Code

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class Main {

  public static void jumpWithNoHistory(Context old, Class<?> cls, int requestCode, Bundle mBundle) {
    Intent intent = new Intent();
    intent.setClass(old, cls);//from  w  w w  . ja v a2s .c  o m
    if (mBundle != null) {
      intent.putExtras(mBundle);
    }

    Activity activity = (Activity) old;
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    activity.startActivityForResult(intent, requestCode);

  }

}

Related Tutorials