GettingSignals

ChromeTabsにメニューを表示する

2015年12月24日
Posted by hina
        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));
Share

Comments are currently closed.

Follow

カレンダー

2024年3月
 123
45678910
11121314151617
18192021222324
25262728293031