List of usage examples for android.support.v4.content.pm ShortcutManagerCompat createShortcutResultIntent
@NonNull public static Intent createShortcutResultIntent(@NonNull Context context, @NonNull ShortcutInfoCompat shortcut)
From source file:org.strongswan.android.ui.VpnProfileSelectActivity.java
@Override public void onVpnProfileSelected(VpnProfile profile) { Intent shortcut = new Intent(VpnProfileControlActivity.START_PROFILE); shortcut.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString()); ShortcutInfoCompat.Builder builder = new ShortcutInfoCompat.Builder(this, profile.getUUID().toString()); builder.setIntent(shortcut);/*from ww w .jav a 2 s . co m*/ builder.setShortLabel(profile.getName()); builder.setIcon(IconCompat.createWithResource(this, R.mipmap.ic_shortcut)); setResult(RESULT_OK, ShortcutManagerCompat.createShortcutResultIntent(this, builder.build())); finish(); }
From source file:org.traccar.client.ShortcutActivity.java
private void setShortcutResult(String label, @DrawableRes int iconResId, String action) { Intent intent = new Intent(Intent.ACTION_DEFAULT, null, this, ShortcutActivity.class); intent.putExtra(EXTRA_ACTION, action); ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(this, action).setShortLabel(label) .setIcon(IconCompat.createWithResource(this, iconResId)).setIntent(intent).build(); setResult(RESULT_OK, ShortcutManagerCompat.createShortcutResultIntent(this, shortcut)); }