本文整理汇总了Java中android.support.v4.app.BundleCompat.getBinder方法的典型用法代码示例。如果您正苦于以下问题:Java BundleCompat.getBinder方法的具体用法?Java BundleCompat.getBinder怎么用?Java BundleCompat.getBinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.BundleCompat
的用法示例。
在下文中一共展示了BundleCompat.getBinder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnected
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
public void onConnected() {
Bundle extras = MediaBrowserCompatApi21.getExtras(this.mBrowserObj);
if (extras != null) {
IBinder serviceBinder = BundleCompat.getBinder(extras, MediaBrowserProtocol.EXTRA_MESSENGER_BINDER);
if (serviceBinder != null) {
this.mServiceBinderWrapper = new ServiceBinderWrapper(serviceBinder);
this.mCallbacksMessenger = new Messenger(this.mHandler);
this.mHandler.setCallbacksMessenger(this.mCallbacksMessenger);
try {
this.mServiceBinderWrapper.registerCallbackMessenger(this.mCallbacksMessenger);
} catch (RemoteException e) {
Log.i(MediaBrowserCompat.TAG, "Remote error registering client messenger.");
}
onServiceConnected(this.mCallbacksMessenger, null, null, null);
}
}
}
示例2: safeGetBinder
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
/**
* Just like {@link BundleCompat#getBinder()}, but doesn't throw exceptions.
*/
public static IBinder safeGetBinder(Bundle bundle, String name) {
if (bundle == null) return null;
try {
return BundleCompat.getBinder(bundle, name);
} catch (Throwable t) {
// Catches un-parceling exceptions.
Log.e(TAG, "getBinder failed on bundle " + bundle);
return null;
}
}
示例3: getSessionTokenFromIntent
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
Bundle b = intent.getExtras();
IBinder binder = BundleCompat.getBinder(b, "android.support.customtabs.extra.SESSION");
return binder == null ? null : new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}
示例4: getSessionTokenFromIntent
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
/**
* Obtain a {@link CustomTabsSessionToken} from an intent. See {@link CustomTabsIntent.Builder}
* for ways to generate an intent for custom tabs.
* @param intent The intent to generate the token from. This has to include an extra for
* {@link CustomTabsIntent#EXTRA_SESSION}.
* @return The token that was generated.
*/
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
Bundle b = intent.getExtras();
IBinder binder = BundleCompat.getBinder(b, CustomTabsIntent.EXTRA_SESSION);
if (binder == null) return null;
return new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}
示例5: launchAsTrustedWebActivity
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
/**
* Launch the given {@link CustomTabsIntent} as a Trusted Web Activity. The given
* {@link CustomTabsIntent} should have a valid {@link CustomTabsSession} associated with it
* during construction. Once the Trusted Web Activity is launched, browser side implementations
* may have their own fallback behavior (e.g. Showing the page in a custom tab UI with toolbar)
* based on qualifications listed above or more.
*
* @param context {@link Context} to use while launching the {@link CustomTabsIntent}.
* @param customTabsIntent The {@link CustomTabsIntent} to use for launching the
* Trusted Web Activity. Note that all customizations in the given
* associated with browser toolbar controls will be ignored.
* @param uri The web page to launch as Trusted Web Activity.
*/
public static void launchAsTrustedWebActivity(@NonNull Context context,
@NonNull CustomTabsIntent customTabsIntent, @NonNull Uri uri) {
if (BundleCompat.getBinder(
customTabsIntent.intent.getExtras(), CustomTabsIntent.EXTRA_SESSION) == null) {
throw new IllegalArgumentException(
"Given CustomTabsIntent should be associated with a valid CustomTabsSession");
}
customTabsIntent.intent.putExtra(EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY, true);
customTabsIntent.launchUrl(context, uri);
}
示例6: getSessionTokenFromIntent
import android.support.v4.app.BundleCompat; //导入方法依赖的package包/类
/**
* Obtain a {@link CustomTabsSessionToken} from an intent. See {@link CustomTabsIntent.Builder}
* for ways to generate an intent for custom tabs.
*
* @param intent The intent to generate the token from. This has to include an extra for
* {@link CustomTabsIntent#EXTRA_SESSION}.
* @return The token that was generated.
*/
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
Bundle b = intent.getExtras();
IBinder binder = BundleCompat.getBinder(b, CustomTabsIntent.EXTRA_SESSION);
if (binder == null) return null;
return new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}