jau*_*ard 6 shortcuts android android-intent android-activity
我有选择活动的问题,我有这个弹出窗口:

文字颜色也是白色和背景.这是我使用的代码:
Bundle bundle = new Bundle();
ArrayList<String> shortcutNames = new ArrayList<String>();
shortcutNames.add(getString(R.string.group_applications));
bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
shortcutIcons.add(ShortcutIconResource.fromContext(this,
R.drawable.ic_launcher));
bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.app_name));
pickIntent.putExtras(bundle);
startActivityForResult(pickIntent, 1);
Run Code Online (Sandbox Code Playgroud)
我终于得到了解决方案:
你需要使用
Intent pickIntent = new Intent(Intent.ACTION_CHOOSER);
Run Code Online (Sandbox Code Playgroud)
其余的还是一样。此代码将为您提供 Holo 对话框。
| 归档时间: |
|
| 查看次数: |
644 次 |
| 最近记录: |