CustomTabsSession
public final class CustomTabsSession
extends Object
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
Inherited methods |
From class java.lang.Object
Object |
clone() Creates and returns a copy of this object. |
boolean |
equals(Object obj) Indicates whether some other object is "equal to" this one. |
void |
finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
final Class<?> |
getClass() Returns the runtime class of this Object . |
int |
hashCode() Returns a hash code value for the object. |
final void |
notify() Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() Wakes up all threads that are waiting on this object's monitor. |
String |
toString() Returns a string representation of the object. |
final void |
wait(long millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this 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. |
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. |