Вопрос

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.?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top