2017-04-12 9 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> 

합니다.