내 appwidget과 활동 사이에 IPC 메커니즘으로 Messenger를 사용하려고합니다.번들에서 메신저가 사라짐 onCreate
다음을 수행합니다. 내 앱 위젯에서 버튼을 클릭 할 때 특정 활동을 시작하는 인 텐트를 만듭니다. 내 위젯 버튼을 클릭하면 내가 가지고있는 유일한 여분의 데이터가 FlashlightModule.Type
예라고 볼 수있는 번들을 볼 때
intent = new Intent(mContext, TorchLightActivity.class);
intent.putExtra(RPC, new Messenger(mHandler));
intent.putExtra(TYPE, mType);
...
final PendingIntent actionPendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
remoteView.setOnClickPendingIntent(layout, actionPendingIntent);
활동은
onCreate(...)
final Bundle bun = getIntent().getExtras();
// Get null here
mMessanger = (Messenger) bun.get(FlashlightModule.RPC);
// Working great
mType = bun.getInt(FlashlightModule.Type);
을 시작 int 값
목적은 (Get the intent from onCreate in Android 참조) 처음부터 엑스트라로 만들어지고 사항 setData은
내 자신의 활동에 AppWidget 사이의 메신저를 통과하는 모든 가능 (Application widget with bundle? 참조) 처음부터 사용?
감사합니다.
이상한 행동을 발견했습니다. 어쩌면 누군가가 그것에 대해 밝힐 수 있습니다. 비슷한 의도와 구별하기 위해 의도에 setData를 사용하고 있습니다 (동일한 액티비티를 사용하지만 다른 엑스트라를 사용하고 있습니다). setData를 갑자기 제거하면 소포가 올바르게 전달됩니다. –