start Activity From Class - Android Activity

Android examples for Activity:Activity Start

Description

start Activity From Class

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;

public class Main {
    public static boolean startActivityFromClass(
            @NonNull final Context context,
            @NonNull final Class<? extends Activity> cls) {
        final Intent i = new Intent(context, cls);
        context.startActivity(i);// ww w  .  j a va 2s . c om
        return true;
    }
}

Related Tutorials