Last active
September 25, 2018 18:49
-
-
Save TangChr/3c7077776dcbbf7060c6 to your computer and use it in GitHub Desktop.
Java: Simulate Home-button in Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dk.tcdev.android.gist; | |
import android.app.Activity; | |
import android.content.Intent; | |
public class MyActivity extends Activity { | |
public void exitApp() { | |
startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm always getting following error:
Can't create handler inside thread that has not called Looper.prepare()
Any solution? Thanks in advance!