Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to prevent toast message when creatin app icon on screen
    primarykey
    data
    text
    <p>I want to create <strong>appp icon</strong> on phone screen and i do it but when i do it <strong>automaticli app creates toast message</strong>, How to prevent this toast message when creatin app icon or deleting icon on screen? Thanks.</p> <p><img src="https://i.stack.imgur.com/ulwsd.png" alt="enter image description here"></p> <p><strong>That is code of how i do it</strong></p> <pre><code>private void addShortcut(){ Intent shortcutIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); // Shortcut name shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); shortcutIntent.putExtra("duplicate", false); ComponentName comp = new ComponentName(this.getPackageName(), "."+this.getLocalClassName()); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp)); // Shortcut icon ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); sendBroadcast(shortcutIntent); } private void delShortcut(){ Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT"); // Shortcut adı shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); String appClass = this.getPackageName() + "." +this.getLocalClassName(); ComponentName comp = new ComponentName(this.getPackageName(), appClass); shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp)); sendBroadcast(shortcut); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); delShortcut(); addShortcut(); </code></pre> <p><strong>Permissions for adding shortcuts</strong></p> <pre><code>&lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"&gt;&lt;/uses-permission&gt; &lt;uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload