What I want to do is:
1) I\'m inside an activity, there are 2 buttons. If I click the first one a shortcut is created in my home screen. The shortcut open an
@Siddiq Abu Bakkar Answer works. But in order to prevent creating shortcut every time app launches use shared Preferences.
final String PREF_FIRST_START = "AppFirstLaunch";
SharedPreferences settings = getSharedPreferences(PREF_FIRST_START, 0);
if(settings.getBoolean("AppFirstLaunch", true)){
// record the fact that the app has been started at least once
settings.edit().putBoolean("AppFirstLaunch", false).commit();
ShortcutIcon();
}