0

I have created a Service that will play the song in the background. I need the DataBase Cursor from the Service when the song is changed in the service.

I have a function in the Service Which returns the Cursor of the Current Song.

public Cursor getCursor() {
    return nextmanagedCursor;
}

The Problem is in the AIDL interface, when i declare the function in the AIDL interface it eclipse gives the following error.

Couldn't find import for class android.database.Cursor

the aidl file contents are as shown below

package com.bobcares.pixie.audio;

import android.database.Cursor; /* Error in this line cannot import android.database.Cursor*/

interface IAudioInterface{

Cursor getCursor();

}

Is this is the right way to use non-primitive Datatypes in the AIDL file

4

1 回答 1

1

Actually the problem is that Cursor is not a Parcelable class, it is an interface. So you cannot transfer it using aidl. You should use wrappers around it. But I do not know what kind of wrappers you need because I've not worked with them. Maybe CrossProcessCursor is what you are looking for.

于 2012-02-18T22:58:32.387 回答