jump to Activity With No History - Android Activity

Android examples for Activity:Activity Jump

Description

jump to Activity With No History

Demo Code


//package com.java2s;

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);/* ww  w . j a  v a 2 s  .  co m*/
        if (mBundle != null) {
            intent.putExtras(mBundle);
        }

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

    }
}

Related Tutorials