本文整理了Java中android.os.Parcel.readHashMap()
方法的一些代码示例,展示了Parcel.readHashMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.readHashMap()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:readHashMap
[英]Please use #readBundle(ClassLoader) instead (whose data must have been written with #writeBundle. Read and return a new HashMap object from the parcel at the current dataPosition(), using the given class loader to load any enclosed Parcelables. Returns null if the previously written map object was null.
[中]请改用#readBundle(ClassLoader)(其数据必须是用#writeBundle写入的。从当前dataPosition()处的包裹中读取并返回一个新的HashMap对象,使用给定的类加载器加载任何封闭的包裹。如果之前写入的映射对象为null,则返回null。
代码示例来源:origin: lingochamp/FileDownloader
protected FileDownloadHeader(Parcel in) {
//noinspection unchecked
this.mHeaderMap = in.readHashMap(String.class.getClassLoader());
}
代码示例来源:origin: android-hacker/VirtualXposed
public static Bundle readMeta(Parcel p) {
Bundle meta = new Bundle();
//noinspection unchecked
Map<String, String> map = p.readHashMap(String.class.getClassLoader());
for (Map.Entry<String, String> entry : map.entrySet()) {
meta.putString(entry.getKey(), entry.getValue());
}
return meta;
}
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void readPersistenceData(Parcel p) {
final SparseArray<HashMap<String, VSConfig>> configs = mService.getConfigs();
int N = p.readInt();
while (N-- > 0) {
int userId = p.readInt();
//noinspection unchecked
HashMap<String, VSConfig> userMap = p.readHashMap(VSConfig.class.getClassLoader());
configs.put(userId, userMap);
}
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void readPersistenceData(Parcel p) {
mGlobalConfig.set(new VLocConfig(p));
mLocConfigs.clear();
int size = p.readInt();
while (size-- > 0) {
int userId = p.readInt();
//noinspection unchecked
Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader());
mLocConfigs.put(userId, pkgs);
}
}
};
代码示例来源:origin: robolectric/robolectric
@Test
public void testReadWriteMap() throws Exception {
HashMap<String, String> original = new HashMap<>();
original.put("key", "value");
parcel.writeMap(original);
parcel.setDataPosition(0);
HashMap<String, String> rehydrated = parcel.readHashMap(null);
assertEquals("value", rehydrated.get("key"));
}
代码示例来源:origin: Doist/JobSchedulerCompat
@SuppressWarnings("unchecked")
PersistableBundle(Parcel in) {
this.map = (HashMap<String, Object>) in.readHashMap(PersistableBundle.class.getClassLoader());
}
代码示例来源:origin: codezjx/AndLinker
@Override
public Map createFromParcel(Parcel in) {
return in.readHashMap(getClass().getClassLoader());
}
代码示例来源:origin: cn.leancloud.android/avoscloud-statistics
private AnalyticsEvent(Parcel in) {
this.duration = in.readParcelable(AnalyticsEvent.class.getClassLoader());
this.attributes = in.readHashMap(Map.class.getClassLoader());
this.eventName = in.readString();
this.labelName = in.readString();
this.primaryKey = in.readString();
this.accumulation = in.readInt();
}
代码示例来源:origin: bzsome/VirtualApp-x326
public static Bundle readMeta(Parcel p) {
Bundle meta = new Bundle();
//noinspection unchecked
Map<String, String> map = p.readHashMap(String.class.getClassLoader());
for (Map.Entry<String, String> entry : map.entrySet()) {
meta.putString(entry.getKey(), entry.getValue());
}
return meta;
}
}
代码示例来源:origin: darkskygit/VirtualApp
public static Bundle readMeta(Parcel p) {
Bundle meta = new Bundle();
//noinspection unchecked
Map<String, String> map = p.readHashMap(String.class.getClassLoader());
for (Map.Entry<String, String> entry : map.entrySet()) {
meta.putString(entry.getKey(), entry.getValue());
}
return meta;
}
}
代码示例来源:origin: JumeiRdGroup/Router
protected RemoteRule(Parcel in) {
name = in.readString();
params = in.readHashMap(getClass().getClassLoader());
type = in.readInt();
extra = in.readBundle(getClass().getClassLoader());
}
代码示例来源:origin: darkskygit/VirtualApp
@Override
public void readPersistenceData(Parcel p) {
final SparseArray<HashMap<String, VSConfig>> configs = mService.getConfigs();
int N = p.readInt();
while (N-- > 0) {
int userId = p.readInt();
//noinspection unchecked
HashMap<String, VSConfig> userMap = p.readHashMap(VSConfig.class.getClassLoader());
configs.put(userId, userMap);
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
@Override
public void readPersistenceData(Parcel p) {
final SparseArray<HashMap<String, VSConfig>> configs = mService.getConfigs();
int N = p.readInt();
while (N-- > 0) {
int userId = p.readInt();
//noinspection unchecked
HashMap<String, VSConfig> userMap = p.readHashMap(VSConfig.class.getClassLoader());
configs.put(userId, userMap);
}
}
代码示例来源:origin: GrassQing/CommonPrintProvider
public PrintFormat createFromParcel(Parcel source) {
PrintFormat format = new PrintFormat();
format.mMap = source.readHashMap(HashMap.class.getClassLoader());
return format;
}
代码示例来源:origin: OceanLabs/Android-Print-SDK
protected Job( Parcel sourceParcel )
{
mId = sourceParcel.readLong();
mProduct = Product.CREATOR.createFromParcel( sourceParcel );
mOrderQuantity = sourceParcel.readInt();
mOptionsMap = sourceParcel.readHashMap( HashMap.class.getClassLoader() );
}
代码示例来源:origin: laizimo/richeditor
protected SaveState(Parcel in) {
super(in);
this.pathRecord = (ArrayDeque<MenuItem>) in.readSerializable();
this.menuItemTree = in.readParcelable(MenuItemTree.class.getClassLoader());
this.bottomMenuItems = in.readHashMap(HashMap.class.getClassLoader());
}
代码示例来源:origin: NordicSemiconductor/Android-nRF-Mesh-Library
protected Element(Parcel in) {
elementAddress = in.createByteArray();
locationDescriptor = in.readInt();
meshModels = new LinkedHashMap<>();
sortModels(in.readHashMap(MeshModel.class.getClassLoader()));
}
代码示例来源:origin: NordicSemiconductor/Android-nRF-Mesh-Library
@SuppressWarnings("unchecked")
protected MeshModel(final Parcel in) {
final int modelId = in.readInt();
if (modelId < Short.MIN_VALUE || modelId > Short.MAX_VALUE) {
mModelId = modelId;
} else {
mModelId = (short) modelId;
}
in.readList(mBoundAppKeyIndexes, Integer.class.getClassLoader());
sortAppKeys(in.readHashMap(ApplicationKey.class.getClassLoader()));
try {
mPublicationSettings = (PublicationSettings) in.readValue(PublicationSettings.class.getClassLoader());
in.readList(mSubscriptionAddress, byte[].class.getClassLoader());
} catch (Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
@Override
public void readPersistenceData(Parcel p) {
mGlobalConfig.set(new VLocConfig(p));
mLocConfigs.clear();
int size = p.readInt();
while (size-- > 0) {
int userId = p.readInt();
//noinspection unchecked
Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader());
mLocConfigs.put(userId, pkgs);
}
}
};
代码示例来源:origin: darkskygit/VirtualApp
@Override
public void readPersistenceData(Parcel p) {
mGlobalConfig.set(new VLocConfig(p));
mLocConfigs.clear();
int size = p.readInt();
while (size-- > 0) {
int userId = p.readInt();
//noinspection unchecked
Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader());
mLocConfigs.put(userId, pkgs);
}
}
};
内容来源于网络,如有侵权,请联系作者删除!