2017-04-12 1 views
0

shortcut.xmlを使用して静的ショートカットを実装する際、私は自分の意図でいくつかのバンドルエクストラを渡したいと思います。Androidショートカット[shortcuts.xmlの余分な(または何らかのデータ)を渡す]

には、アプリを起動した後にターゲットクラスの機能がほとんどないと判断するために必要なものが必要です。

エクストラにアクセスすることは可能ですか?どのようにどこにアクセスするのですか?

なぜあなたはダイナミックなショートカットを作成していない以外の任意のリードは非常に

答えて

0

をいただければ幸いですか!

ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); 

Intent thirdIntent = new Intent(this,ThirdActivity.class); 
thirdIntent.setAction(Intent.ACTION_VIEW); 

ShortcutInfo thirdScreenShortcut = new ShortcutInfo.Builder(this, "shortcut_third") 
     .setShortLabel("Third Activity") 
     .setLongLabel("This is long description for Third Activity") 
     .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher)) 
     .setIntent(thirdIntent) 
     .build(); 
shortcutManager.setDynamicShortcuts(Collections.singletonList(thirdScreenShortcut)); 

あなたはIntentに送信し、活動を受信機にそれをアクセスしたいものは何でも渡すことができます。

0

私は別の方法があるかどうかわからないんだけど、私はこれを使用します。

<intent 
     android:action="android.intent.action.VIEW" 
     android:targetPackage="target.package" 
     android:targetClass="activity.with.package"> 
     <extra android:name="extraID" android:value="extravalue" /> 
</intent> 

その後、あなたはいつものように余分にアクセスすることができます。

関連する問題