0
私はこのshortcuts.xmlからInComingShortcuts.java活動でカスタムメソッドを呼び出すためにshortcuts.xmlからカスタム意図を受信する必要が
public class InComingShortcuts extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SharedPreferences setting = context.getSharedPreferences("settings", 0);
String TAG="PocketModeService";
if(intent.getAction().equals("com.rituj.theoneplus3app.gestures")){
Log.d(TAG, "Got gestures Broadcast");
}
}}
でカスタムの意図を受信しようとしてきたねえ。
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_gestures"
android:shortcutDisabledMessage="@string/static_shortcut_disabled_message"
android:shortcutId="static"
android:shortcutLongLabel="@string/static_shortcut_long_label"
android:shortcutShortLabel="@string/static_shortcut_short_label">
<intent
android:action="com.rituj.theoneplus3app.gestures"/>
</shortcut>
</shortcuts>
とAndroidManifestは、次のようになります。私はアンドロイドノウを実装しようとしている
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="packagename">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="App LAbel"
android:supportsRtl="true"
android:theme="@style/AppThemeLight">
<receiver
android:name="com.rituj.theoneplus3app.InComingShortcuts"
android:enabled="true">
<intent-filter>
<action android:name="com.rituj.theoneplus3app.gestures" />
</intent-filter>
</receiver>
<activity
android:name=".Home"
android:label="Label"
android:theme="@style/AppThemeLight"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity>
</application>
</manifest>
7.1.1のアプリのショートカットをgatしてください。 その名前の意図はまったく受け取りません。 ご協力いただければ幸いです。 ユーザーがそのショートカットを押した場合、別のレイアウトを展開するために特定のメソッドを呼び出す必要があります。どうすればいいの?
を実行している場合は注意してください
com.x.y.z
は、「デバッグ」で終わる可能性がしかし、これは右、主な活動を開始するでしょうか?ユーザーがそのショートカットを押した場合、別のレイアウトを展開するために特定のメソッドを呼び出す必要があります。どうすればいいの? –あなたはその意図を「XYZActivity」で扱うことができますか?で解析されたデータに基づいて、任意のメソッドを呼び出すことができます – WenChao
ええ、ありがとう。最終的にそれを考え出す。 –