Starts Activity by creating an intent - Android Activity

Android examples for Activity:Activity Start

Description

Starts Activity by creating an intent

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.Intent;

public class Main {
    /**// w  ww. j a v  a2  s  . c o  m
     * Starts Activity by creating an intent
     * @param context
     * @param clazz
     */
    public static void startActivity(Context context, Class clazz) {
        Intent intent = new Intent(context, clazz);
        context.startActivity(intent);
    }
}

Related Tutorials