Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Instrumentation;
import android.view.KeyEvent;

public class Main {
    /**
     * this function work by permission.
     */
    public static void pressHome() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Instrumentation m_Instrumentation = new Instrumentation();
                m_Instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_HOME);
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                m_Instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_HOME);
            }
        }).start();

    }
}