go To Activity by target activity class - Android android.app

Android examples for android.app:Activity Property

Description

go To Activity by target activity class

Demo Code

import android.content.Context;
import android.content.Intent;

public class Main{

    public static void goToActivity(Context packageContext,
            Class<?> targetActivityClass) {
        Intent intent = new Intent();
        intent.setClass(packageContext, targetActivityClass);
        packageContext.startActivity(intent);
    }//from w  ww . ja  v a  2s  .co  m

}

Related Tutorials