How to make icon of app on desktop? Problems with WebView


Last Updated:

  1. vovs

    vovs Active Member

    Hi, guys!
    In my app I have one activity with WebView.

    When I push Home button and then click on icon my app -- web page do not reload - it is good. But in code I create icon manually:

    Code (Text):
    1. private void createIcon(int iconId){
    2.         final Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    3.         ComponentName name = new ComponentName(getPackageName(), ".FullScreenBrowserActivity");
    4.         shortcutIntent.setComponent(name);
    5.         shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    6.         shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    7.  
    8.         Intent addIntent = new Intent();
    9.         addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    10.         addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Fulscreen Browser");
    11.         addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, iconId));
    12.  
    13.         addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    14.         this.sendBroadcast(addIntent);
    15.     }
    When I click this icon - app starts new copy of themselfs and webpage starts loading.

    How to make new icon on desktop manual(after install) and when click on icon - webpage in WebView do no reloading?

    Thanks!

    Advertisement

Share This Page