Android 打开从GCMinentClass到片段类的命名
我收到了来自GCM的通知。。。在我的GCMinentService课程中,我做到了这一点Android 打开从GCMinentClass到片段类的命名,android,android-intent,android-fragments,google-cloud-messaging,Android,Android Intent,Android Fragments,Google Cloud Messaging,我收到了来自GCM的通知。。。在我的GCMinentService课程中,我做到了这一点 Intent notificationIntent = new Intent(GcmIntentService.this, HomeActivity.class); 当我点击通知时,我希望它打开一个片段。。。。。我在HomeActivity.class中有我的片段,我想从中打开消息片段 Intent notificationIntent = new Intent(GcmInten
Intent notificationIntent = new Intent(GcmIntentService.this,
HomeActivity.class);
当我点击通知时,我希望它打开一个片段
。。。。。我在HomeActivity.class中有我的片段
,我想从中打开消息片段
Intent notificationIntent = new Intent(GcmIntentService.this,
HomeActivity.class );
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(GcmIntentService.this, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
您可以像这样通过
Intent
传递参数
notificationIntent.putExtra(“片段”,1)代码>
其中1是片段索引,在家庭活动中可以使用该索引
int id=getIntent().getIntExtra(“片段”,0);
viewPager.setCurrentItem(id);
它将我带到“片段”选项卡,但片段没有加载。@交付您可以共享您的代码吗。这样我才能帮助你。