start home Activity intent - Android Intent

Android examples for Intent:Open App

Description

start home Activity intent

Demo Code


//package com.java2s;

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

public class Main {
    /**/*from w  ww .j  a va 2 s . c  o m*/
     * start home intent
     *
     * @param context
     */
    public static void startHomeActivity(Context context) {
        Intent homeIntent = new Intent(Intent.ACTION_MAIN);
        homeIntent.addCategory(Intent.CATEGORY_HOME);
        homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        context.startActivity(homeIntent);
    }
}

Related Tutorials