本文整理了Java中android.os.Parcel.writeException()
方法的一些代码示例,展示了Parcel.writeException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeException()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeException
[英]Special function for writing an exception result at the header of a parcel, to be used when returning an exception from a transaction. Note that this currently only supports a few exception types; any other exception will be re-thrown by this function as a RuntimeException (to be caught by the system's last-resort exception handling when dispatching a transaction).
The supported exception types are:
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean transact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
if (data != null) {
data.setDataPosition(0);
}
boolean result;
try {
result = new ShadowBinderBridge(realObject).onTransact(code, data, reply, flags);
} catch (Exception e) {
result = true;
if (reply != null) {
reply.writeException(e);
}
}
if (reply != null) {
reply.setDataPosition(0);
}
return result;
}
代码示例来源:origin: stackoverflow.com
logException = false;
} else {
reply.writeException(e);
Log.e(TAG, "Writing exception to parcel", e);
return;
代码示例来源:origin: mapsforge/mapsforge
logException = false;
} else {
reply.writeException(e);
Log.e(TAG, "Writing exception to parcel", e);
return;
代码示例来源:origin: bzsome/VirtualApp-x326
public void handleTransact(Object server, Parcel data, Parcel reply) {
data.enforceInterface(interfaceName);
Object[] parameters = data.readArray(getClass().getClassLoader());
if (parameters != null && parameters.length > 0) {
for (int i = 0; i < parameters.length; i++) {
if (converters[i] != null) {
parameters[i] = converters[i].convert(parameters[i]);
}
}
}
try {
Object res = method.invoke(server, parameters);
reply.writeNoException();
reply.writeValue(res);
} catch (IllegalAccessException e) {
e.printStackTrace();
reply.writeException(e);
} catch (InvocationTargetException e) {
e.printStackTrace();
reply.writeException(e);
}
}
代码示例来源:origin: org.robolectric/framework
@Implementation
public boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (data != null) {
data.setDataPosition(0);
}
boolean result;
try {
result = new ShadowBinderBridge(realObject).onTransact(code, data, reply, flags);
} catch (Exception e) {
result = true;
if (reply != null) {
reply.writeException(e);
}
}
if (reply != null) {
reply.setDataPosition(0);
}
return result;
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected boolean transact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
if (data != null) {
data.setDataPosition(0);
}
boolean result;
try {
result = new ShadowBinderBridge(realObject).onTransact(code, data, reply, flags);
} catch (Exception e) {
result = true;
if (reply != null) {
reply.writeException(e);
}
}
if (reply != null) {
reply.setDataPosition(0);
}
return result;
}
代码示例来源:origin: org.robolectric/shadows-core
@Implementation
public boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (data != null) {
data.setDataPosition(0);
}
boolean result;
try {
result = new ShadowBinderBridge(realObject).onTransact(code, data, reply, flags);
} catch (Exception e) {
result = true;
if (reply != null) {
reply.writeException(e);
}
}
if (reply != null) {
reply.setDataPosition(0);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!