Create Intent to behave As Home Button - Android Intent

Android examples for Intent:Open App

Description

Create Intent to behave As Home Button

Demo Code


//package com.java2s;

import android.content.Intent;

public class Main {
    public static Intent behaveAsHomeButton() {
        Intent i = new Intent(Intent.ACTION_MAIN);
        i.addCategory(Intent.CATEGORY_HOME);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        return i;
    }/* ww  w. jav a  2  s  .co m*/
}

Related Tutorials