Most visited

Recently visited

CustomTabsSession

public final class CustomTabsSession
extends Object

java.lang.Object
   ↳ android.support.customtabs.CustomTabsSession


A class to be used for Custom Tabs related communication. Clients that want to launch Custom Tabs can use this class exclusively to handle all related communication.

Summary

Public methods

boolean mayLaunchUrl(Uri url, Bundle extras, List<Bundle> otherLikelyBundles)

Tells the browser of a likely future navigation to a URL.

boolean setActionButton(Bitmap icon, String description)

This sets the action button on the toolbar with ID TOOLBAR_ACTION_BUTTON_ID.

boolean setToolbarItem(int id, Bitmap icon, String description)

Updates the visuals for toolbar items.

Inherited methods

From class java.lang.Object

Public methods

mayLaunchUrl

boolean mayLaunchUrl (Uri url, 
                Bundle extras, 
                List<Bundle> otherLikelyBundles)

Tells the browser of a likely future navigation to a URL. The most likely URL has to be specified first. Optionally, a list of other likely URLs can be provided. They are treated as less likely than the first one, and have to be sorted in decreasing priority order. These additional URLs may be ignored. All previous calls to this method will be deprioritized.

Parameters
url Uri: Most likely URL.
extras Bundle: Reserved for future use.
otherLikelyBundles List: Other likely destinations, sorted in decreasing likelihood order. Inside each Bundle, the client should provide a Uri using KEY_URL with putParcelable(String, android.os.Parcelable).
Returns
boolean true for success.

setActionButton

boolean setActionButton (Bitmap icon, 
                String description)

This sets the action button on the toolbar with ID TOOLBAR_ACTION_BUTTON_ID.

Parameters
icon Bitmap: The new icon of the action button.
description String: Content description of the action button.
Returns
boolean

See also:

setToolbarItem

boolean setToolbarItem (int id, 
                Bitmap icon, 
                String description)

Updates the visuals for toolbar items. Will only succeed if a custom tab created using this session is in the foreground in browser and the given id is valid.

Parameters
id int: The id for the item to update.
icon Bitmap: The new icon of the toolbar item.
description String: Content description of the toolbar item.
Returns
boolean Whether the update succeeded.