2016-12-16 13 views
1

現在のURLを共有するために、新しいメニューアイテムをChromeCustomTabsに追加しようとしています。カスタムタブに共有リンクメニューを追加する方法

私たちは私たちのCustomTabsIntentにデフォルト

.addDefaultShareMenuItem() 

を追加できることを知っています。しかし、私はこれを使用したくありません。

私も同じようPendingIntentを作成することで、メニュー項目を追加する方法を知っている: - 私たちのビルダーでは、我々が追加されます今

Intent urlIntent = new Intent(); 
String currentURL = urlIntent.getDataString(); 
Intent shareIntent = new Intent(Intent.ACTION_SEND); 
shareIntent.setType("text/plain); 
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
shareIntent.putExtra(Intent.EXTRA_TEXT, url); 
PendingIntent p = PendingIntent.getActivity(getBaseContext(), 123, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT); 

: -

.addMenuItem("Share Current Link", p); 

コードがなく、返す作品現在のURLの代わりに空の値を返します。

Intent urlIntent = new Intent(/*what to put here to get customTabs intent*/)には何を入れるべきかわかりません。 インテントではないため、customIntentをここに入力することはできません。

答えて

関連する問題