How to add shortcut to Home screen in android programmatically [duplicate]

Android provide us an intent class com.android.launcher.action.INSTALL_SHORTCUT which can be used to add shortcuts to home screen. In following code snippet we create a shortcut of activity MainActivity with the name HelloWorldShortcut. First we need to add permission INSTALL_SHORTCUT to android manifest xml. <uses-permission android:name=”com.android.launcher.permission.INSTALL_SHORTCUT” /> The addShortcut() method creates a new shortcut on Home … Read more

How can I create a custom home-screen replacement application for Android?

Writing your own home screen application is possible. It is called the Launcher. You can get the source code of the default Android Launcher via Git. The project URL is: https://android.googlesource.com/platform/packages/apps/Launcher2.git You can get the source code like this: git clone https://android.googlesource.com/platform/packages/apps/Launcher2.git That will create a directory called Launcher2 for you. Now you can get … Read more

Going to home screen programmatically

You can do this through an Intent. Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain); This Intent will start the launcher application that the user has defined. Be careful with this because this will look like your application crashed if the user does not expect this. If you want this to build an exit button … Read more

Change default homepage in root path to servlet with doGet

How can I change the contents of this page to something else ? Open the underlying JSP/HTML/XHTML file in a text editor. This page is identified by <welcome-file> entry in web.xml. If it’s e.g. <welcome-file>index.jsp</welcome-file>, then you need to open /index.jsp file in your project’s web content in the IDE builtin text editor. Or, at … Read more