本文整理匯總了Java中android.os.Bundle.putBinder方法的典型用法代碼示例。如果您正苦於以下問題:Java Bundle.putBinder方法的具體用法?Java Bundle.putBinder怎麽用?Java Bundle.putBinder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putBinder方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendCommand
import android.os.Bundle; //導入方法依賴的package包/類
public static void sendCommand(Context context,ResolveInfo resolveInfo,int cmd) {
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
String sender = serviceInfo.packageName;
Intent intent = new Intent();
intent.setAction(serviceInfo.packageName+"._SERVICE_");
intent.setPackage(sender);
Bundle binderBunder = new Bundle();
binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_BINDER, ServiceManagerThread.getDefault());
binderBunder.putString(ServiceContext.EXTRA_BUNDLE_PACKAGE_NAME, sender);
intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
intent.putExtra(ServiceContext.EXTRA_COMMAND, cmd);
LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendCommand start service pkg name = "+serviceInfo.packageName+", class name = " + serviceInfo.name);
ComponentName componentName = context.startService(intent);
LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendCommand start service result = " + componentName);
}
示例2: sendServerCommand
import android.os.Bundle; //導入方法依賴的package包/類
public static void sendServerCommand(Context context,int cmd,IBinder callback){
Intent intent = new Intent();
intent.setAction(ServiceContext.ACTION_REMOTE_CLIENT_COMMAND);
intent.setPackage(ServiceContext.SERVER_PACKAGE_NAME);
String sender = context.getPackageName();
Bundle binderBunder = new Bundle();
binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_SERVER_READY_BINDER, callback);
binderBunder.putString(ServiceContext.EXTRA_BUNDLE_PACKAGE_NAME, sender);
intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
intent.putExtra(ServiceContext.EXTRA_COMMAND, cmd);
ComponentName componentName = context.startService(intent);
LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendServerCommand start service result = " + componentName);
}
示例3: attachToActivityManagerService
import android.os.Bundle; //導入方法依賴的package包/類
private static void attachToActivityManagerService(Context context) {
LogControler.print(Level.INFO, "[ServerManagerThread] attach To ActivityManagerService");
Intent intent = new Intent(ServiceContext.ACTION_RECEIVE_SERVICE_MANAGER);
Bundle binderBunder = new Bundle();
binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_BINDER, ServiceManagerThread.getDefault());
intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
intent.putExtra(ServiceContext.EXTRA_COMMAND, ServiceContext.CMD_CREATE_CLIENT_SERVICE_MANAGER);
context.sendStickyBroadcast(intent);
}
示例4: writeRemoter
import android.os.Bundle; //導入方法依賴的package包/類
/**
* Writes the @Remoter data
*/
private void writeRemoter(Object data, Bundle bundle, String keyPrefix) throws Exception {
Class remoterInterfaceClass = getRemoterBinder(data);
if (remoterInterfaceClass != null) {
Class remoterStubClass = Class.forName(remoterInterfaceClass.getName() + "_Stub");
Constructor constructor = remoterStubClass.getConstructor(remoterInterfaceClass);
IBinder binder = (IBinder) constructor.newInstance(data);
bundle.putString(RemoteEventManager.REMOTE_DATA_EXTRA + keyPrefix, remoterInterfaceClass.getName());
bundle.putBinder(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, binder);
}
}
示例5: putBinder
import android.os.Bundle; //導入方法依賴的package包/類
public static void putBinder(Bundle bundle, String key, IBinder value) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
bundle.putBinder(key, value);
} else {
try {
ReflectUtil.invoke(Bundle.class, bundle, "putIBinder", new Class[]{String.class, IBinder.class}, key, value);
} catch (Exception e) {
}
}
}
示例6: putBinder
import android.os.Bundle; //導入方法依賴的package包/類
public static void putBinder(Bundle bundle, String key, IBinder value) {
if (Build.VERSION.SDK_INT >= 18) {
bundle.putBinder(key, value);
} else {
mirror.android.os.Bundle.putIBinder.call(bundle, key, value);
}
}
示例7: putBinder
import android.os.Bundle; //導入方法依賴的package包/類
public static void putBinder(Bundle bundle, String key, IBinder value) {
if (Build.VERSION.SDK_INT >= 18) {
bundle.putBinder(key, value);
} else {
mirror.android.os.Bundle.putIBinder.call(bundle, key, value);
}
}
示例8: putBinder
import android.os.Bundle; //導入方法依賴的package包/類
public static void putBinder(Bundle bundle, String key, IBinder binder) {
bundle.putBinder(key, binder);
}
示例9: send
import android.os.Bundle; //導入方法依賴的package包/類
@Override
public Bundle send(Bundle bundle) {
bundle.putBinder(ServiceContext.EXTRA_CALLBACK, new IBinderCallback(mCallback));
return mBundleSender.send(bundle);
}