本文整理了Java中android.os.Parcel.readValue()
方法的一些代码示例,展示了Parcel.readValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.readValue()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:readValue
[英]Read a typed object from a parcel. The given class loader will be used to load any enclosed Parcelables. If it is null, the default class loader will be used.
[中]从包裹中读取键入的对象。给定的类装入器将用于装入任何封闭的包裹。如果为空,将使用默认的类装入器。
代码示例来源:origin: rey5137/material
/**
* Constructor called from {@link #CREATOR}
*/
private SavedState(Parcel in) {
super(in);
checked = (Boolean)in.readValue(null);
}
代码示例来源:origin: naman14/Timber
private SavedState(Parcel in) {
super(in);
played = (Boolean) in.readValue(null);
}
代码示例来源:origin: seven332/EhViewer
/**
* Constructor called from {@link #CREATOR}
*/
@SuppressLint("ParcelClassLoader")
private SavedState(Parcel in) {
super(in);
mSerializedPattern = in.readString();
mDisplayMode = in.readInt();
mInputEnabled = (Boolean) in.readValue(null);
mInStealthMode = (Boolean) in.readValue(null);
mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
代码示例来源:origin: ZieIony/Carbon
/**
* Constructor called from {@link #CREATOR}
*/
private SavedState(Parcel in) {
super(in);
checked = (Boolean) in.readValue(getClass().getClassLoader());
}
代码示例来源:origin: commonsguy/cw-omnibus
private ParcelableSparseBooleanArray(Parcel source) {
int size=source.readInt();
for (int i=0; i < size; i++) {
put(source.readInt(), (Boolean)source.readValue(null));
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private ParcelableSparseBooleanArray(Parcel source) {
int size=source.readInt();
for (int i=0; i < size; i++) {
put(source.readInt(), (Boolean)source.readValue(null));
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private ParcelableSparseBooleanArray(Parcel source) {
int size=source.readInt();
for (int i=0; i < size; i++) {
put(source.readInt(), (Boolean)source.readValue(null));
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private ParcelableSparseBooleanArray(Parcel source) {
int size=source.readInt();
for (int i=0; i < size; i++) {
put(source.readInt(), (Boolean)source.readValue(null));
}
}
代码示例来源:origin: nickbutcher/plaid
ReflowData(Parcel in) {
text = in.readString();
textSize = in.readFloat();
textColor = in.readInt();
bounds = (Rect) in.readValue(Rect.class.getClassLoader());
fontResId = in.readInt();
lineSpacingAdd = in.readFloat();
lineSpacingMult = in.readFloat();
textPosition = (Point) in.readValue(Point.class.getClassLoader());
textHeight = in.readInt();
textWidth = in.readInt();
breakStrategy = in.readInt();
letterSpacing = in.readFloat();
maxLines = in.readInt();
}
代码示例来源:origin: firebase/firebase-jobdispatcher-android
/**
* Reads the next key (String) from the provided {@code serialized} Parcel.
*
* <p>Naively using {@link Parcel#readString()} fails on versions of Android older than L, whereas
* {@link Parcel#readValue(ClassLoader)} works on older versions but fails on anything L or newer.
*/
private static String readKey(Parcel serialized) {
if (shouldReadKeysAsStrings()) {
return serialized.readString();
}
// Older platforms require readValue
@SuppressLint("ParcelClassLoader") // We're just reading a string
Object entryKeyObj = serialized.readValue(null /* Use the system ClassLoader */);
if (!(entryKeyObj instanceof String)) {
// Should never happen (Bundle keys are always Strings)
Log.w(TAG, ERROR_INVALID_CALLBACK);
return null;
}
return (String) entryKeyObj;
}
代码示例来源:origin: AltBeacon/android-beacon-library
mParserIdentifier = in.readString();
mMultiFrameBeacon = in.readByte() != 0;
mRunningAverageRssi = (Double) in.readValue(null);
mRssiMeasurementCount = in.readInt();
mPacketCount = in.readInt();
代码示例来源:origin: facebook/facebook-android-sdk
private static UserInfo decodeUserInfo(String base64EncodedToken) {
byte[] data = Base64.decode(base64EncodedToken, Base64.DEFAULT);
Parcel parcel = Parcel.obtain();
parcel.unmarshall(data, 0, data.length);
parcel.setDataPosition(0);
UserInfo userInfo = (UserInfo) parcel.readValue(UserInfo.class.getClassLoader());
parcel.recycle();
return userInfo;
}
代码示例来源:origin: konmik/nucleus
when(parcel.readValue(any(ClassLoader.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
代码示例来源:origin: konmik/nucleus
static <T> T unmarshall(byte[] array) {
Parcel parcel = Parcel.obtain();
parcel.unmarshall(array, 0, array.length);
parcel.setDataPosition(0);
Object value = parcel.readValue(CLASS_LOADER);
parcel.recycle();
return (T)value;
}
代码示例来源:origin: firebase/firebase-jobdispatcher-android
Object value = serialized.readValue(null /* class loader */);
if (value instanceof String) {
cleanBundle.putString(entryKey, (String) value);
代码示例来源:origin: oasisfeng/condom
@Override protected boolean onTransact(final int code, final Parcel data, final Parcel reply, final int flags) throws RemoteException {
try {
final Class<?> clazz = Class.forName(data.readString());
final Constructor<?> constructor = clazz.getDeclaredConstructors()[0];
constructor.setAccessible(true);
final Class<?>[] parameter_types = constructor.getParameterTypes();
final Object[] args = new Object[parameter_types.length];
for (int i = 0; i < args.length; i++) {
if (parameter_types[i] == Context.class) args[i] = TestService.this;
else if (parameter_types[i] == Application.class) args[i] = getApplication();
else args[i] = data.readValue(getClassLoader());
}
final Procedure procedure = (Procedure) constructor.newInstance(args);
procedure.run(TestService.this);
reply.writeValue(null);
} catch (final Throwable t) {
reply.writeValue(t);
}
return true;
}
};
代码示例来源:origin: oasisfeng/condom
final Throwable e = (Throwable) reply.readValue(TestService.class.getClassLoader());
if (e instanceof Error) throw (Error) e;
if (e instanceof RuntimeException) throw (RuntimeException) e;
代码示例来源:origin: shchurov/HorizontalWheelView
private SavedState(Parcel in) {
super(in);
angle = (Double) in.readValue(null);
}
代码示例来源:origin: stackoverflow.com
Foo foo1 = new Foo("a", "b", "c");
Parcel p = Parcel.obtain();
p.writeValue(foo1);
p.setDataPosition(0);
Foo foo2 = (Foo)p.readValue(Foo.class.getClassLoader());
p.recycle();
代码示例来源:origin: parse-community/Parse-SDK-Android
return source.readValue(null); // No need for a class loader.
内容来源于网络,如有侵权,请联系作者删除!