Hello
I have a Problem when I tried to use AIDL interface with Lists.
I have 2 AIDL interfaces and I have to use a list with references to
the other AIDL interface instances.
Eclipse generates Java file which contains error.
I use android 1.6 and eclipse here is the my source code
MyDataAIDL.aidl
import de.koch.aidl.EntityAIDL;
interface MyDataAIDL {
void combineFromEntityList(in List<EntityAIDL> aEntityList);
List<EntityAIDL> getEntitys();
}
EntityAIDL.aidl
package de.koch.aidl;
import android.os.IBinder;
interface EntityAIDL{
void setName(String aName);
String getName();
}
Eclipse tells no error in aidl files and generates the classes.
but the generated class contains an error because
de.koch.aidl.EntityAIDL is not from type IBinder.
case TRANSACTION_readDB:
{
data.enforceInterface(DESCRIPTOR);
java.util.List<de.koch.aidl.EntityAIDL> _result = this.readDB();
reply.writeNoException();
reply.writeBinderList(_result);//Here is the Problem
return true;
}
This is clear to me because only the generated Stub is from Typ
IBinder.
But how should I change the AIDL file to get the correct generated
Java File.
Hope you could help.
The generated MyDBAIDL.java file
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file:
*/
package de.koch.aidl;
import java.util.List;
import java.lang.String;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Binder;
import android.os.Parcel;
public interface MyDBAIDL extends android.os.IInterface
{
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements
de.koch.aidl.MyDBAIDL
{
private static final java.lang.String DESCRIPTOR =
"de.koch.aidl.MyDBAIDL";
/** Construct the stub at attach it to the interface. */
public Stub()
{
this.attachInterface(this, DESCRIPTOR);
}
/**
* Cast an IBinder object into an MyDBAIDL interface,
* generating a proxy if needed.
*/
public static de.koch.aidl.MyDBAIDL asInterface(android.os.IBinder
obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin =
(android.os.IInterface)obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof de.koch.aidl.MyDBAIDL))) {
return ((de.koch.aidl.MyDBAIDL)iin);
}
return new de.koch.aidl.MyDBAIDL.Stub.Proxy(obj);
}
public android.os.IBinder asBinder()
{
return this;
}
@Override public boolean onTransact(int code, android.os.Parcel data,
android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_readDB:
{
data.enforceInterface(DESCRIPTOR);
java.util.List<de.koch.aidl.EntityAIDL> _result = this.readDB();
reply.writeNoException();
reply.writeBinderList(_result);
return true;
}
case TRANSACTION_writeDB:
{
data.enforceInterface(DESCRIPTOR);
java.util.List<de.koch.aidl.EntityAIDL> _arg0;
_arg0 = data.createBinderArrayList();
this.writeDB(_arg0);
reply.writeNoException();
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements de.koch.aidl.MyDBAIDL
{
private android.os.IBinder mRemote;
Proxy(android.os.IBinder remote)
{
mRemote = remote;
}
public android.os.IBinder asBinder()
{
return mRemote;
}
public java.lang.String getInterfaceDescriptor()
{
return DESCRIPTOR;
}
public java.util.List<de.koch.aidl.EntityAIDL> readDB() throws
android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
java.util.List<de.koch.aidl.EntityAIDL> _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_readDB, _data, _reply, 0);
_reply.readException();
_result = _reply.createBinderArrayList();
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public void writeDB(java.util.List<de.koch.aidl.EntityAIDL>
aEntityList) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeBinderList(aEntityList);
mRemote.transact(Stub.TRANSACTION_writeDB, _data, _reply, 0);
_reply.readException();
}
finally {
_reply.recycle();
_data.recycle();
}
}
}
static final int TRANSACTION_readDB = (IBinder.FIRST_CALL_TRANSACTION
+ 0);
static final int TRANSACTION_writeDB = (IBinder.FIRST_CALL_TRANSACTION
+ 1);
}
public java.util.List<de.koch.aidl.EntityAIDL> readDB() throws
android.os.RemoteException;
public void writeDB(java.util.List<de.koch.aidl.EntityAIDL>
aEntityList) throws android.os.RemoteException;
}
The generated EntityAIDL.java file
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file:
*/
package de.koch.aidl;
import java.lang.String;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Binder;
import android.os.Parcel;
public interface EntityAIDL extends android.os.IInterface
{
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements
de.koch.aidl.EntityAIDL
{
private static final java.lang.String DESCRIPTOR =
"de.koch.aidl.EntityAIDL";
/** Construct the stub at attach it to the interface. */
public Stub()
{
this.attachInterface(this, DESCRIPTOR);
}
/**
* Cast an IBinder object into an EntityAIDL interface,
* generating a proxy if needed.
*/
public static de.koch.aidl.EntityAIDL asInterface(android.os.IBinder
obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin =
(android.os.IInterface)obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof de.koch.aidl.EntityAIDL))) {
return ((de.koch.aidl.EntityAIDL)iin);
}
return new de.koch.aidl.EntityAIDL.Stub.Proxy(obj);
}
public android.os.IBinder asBinder()
{
return this;
}
@Override public boolean onTransact(int code, android.os.Parcel data,
android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_setName:
{
data.enforceInterface(DESCRIPTOR);
java.lang.String _arg0;
_arg0 = data.readString();
this.setName(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_getName:
{
data.enforceInterface(DESCRIPTOR);
java.lang.String _result = this.getName();
reply.writeNoException();
reply.writeString(_result);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements de.koch.aidl.EntityAIDL
{
private android.os.IBinder mRemote;
Proxy(android.os.IBinder remote)
{
mRemote = remote;
}
public android.os.IBinder asBinder()
{
return mRemote;
}
public java.lang.String getInterfaceDescriptor()
{
return DESCRIPTOR;
}
public void setName(java.lang.String aName) throws
android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeString(aName);
mRemote.transact(Stub.TRANSACTION_setName, _data, _reply, 0);
_reply.readException();
}
finally {
_reply.recycle();
_data.recycle();
}
}
public java.lang.String getName() throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
java.lang.String _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_getName, _data, _reply, 0);
_reply.readException();
_result = _reply.readString();
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
static final int TRANSACTION_setName = (IBinder.FIRST_CALL_TRANSACTION
+ 0);
static final int TRANSACTION_getName = (IBinder.FIRST_CALL_TRANSACTION
+ 1);
}
public void setName(java.lang.String aName) throws
android.os.RemoteException;
public java.lang.String getName() throws android.os.RemoteException;
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en