Intent intent1 = new Intent(context, MyService.class);
intent1.putExtra("TYPE", 1);
intent1.putExtra("URL", url1);
PendingIntent pendingIntent1 = PendingIntent.getService( context, 1, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
Intent intent2 = new Intent(context, MyService.class);
intent2.putExtra("TYPE", 2);
intent2.putExtra("URL", url2);
PendingIntent pendingIntent2 = PendingIntent.getService( context, 2, intent2, PendingIntent.FLAG_UPDATE_CURRENT);
Intent intent3 = new Intent(context, MyService.class);
intent3.putExtra("TYPE", 3);
intent3.putExtra("URL", url3);
PendingIntent pendingIntent3 = PendingIntent.getService( context, 3, intent3, PendingIntent.FLAG_UPDATE_CURRENT);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder
.setToolbarColor(context.getResources().getColor(R.color.colorPrimary))
.setShowTitle(true)
.addMenuItem(context.getString(R.string.disp_name1), pendingIntent1)
.addMenuItem(context.getString(R.string.disp_name2), pendingIntent2)
.addMenuItem(context.getString(R.string.disp_name3), pendingIntent3)
.build();
// Chrome Custom Tabs の開始
customTabsIntent.launchUrl(context, Uri.parse(url));
関連
Comments are currently closed.