Question

Here is the sample code which creates some specified shortcuts on the Android home screen:

public void setupShortCut(String iconName, String siteAddress)
{
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse(siteAddress));

Intent installer = new Intent();
installer.putExtra(Intent.EXTRA_SHORTCUT_INTENT, i);
installer.putExtra(Intent.EXTRA_SHORTCUT_NAME, iconName);       
installer.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(installer);
}

The question is: how can I change current page of the home screen to create new shortcut not on the currently selected page, but on the specified one? Or maybe there's a way to specify home screen page number to put new shortcut on in addition to shortcut's name, bitmap etc.?

Was it helpful?

Solution

You cannot do this (as long as we talk about launchers in general). This would be of no real use as you do not know how many screens user got and if one of your choice is not full by any chance already.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top