Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;

import android.content.Intent;

import android.view.KeyEvent;

public class Main {
    public static boolean onKeyBackGoHome(Activity activity, int i, KeyEvent keyEvent) {
        if (i != 4 || keyEvent.getRepeatCount() != 0) {
            return false;
        }
        activity.startActivity(
                new Intent().setAction("android.intent.action.MAIN").addCategory("android.intent.category.HOME"));
        return true;
    }
}