Android: Couldn't find import for class java.util.ArrayList in aidl file

可紊 提交于 2019-12-09 00:36:01

问题


I currently have a remote service which gets the users current location (this is all working fine). I now want to be able to get the users current location then add a to a list of previous locations. Here is my aidl file, where i'm having a problem :

import android.location.Location;
import java.util.ArrayList; //error line: couldn't find import for class java.util.ArrayList

interface ILocationService {
    Location getCurrentLocation();
    ArrayList<Location> getAllLocations();
}

Any help would be much appreciated. Thanks.


回答1:


(As per my comment, which apparently fixed the problem)

Use java.util.List<Location> instead of java.util.ArrayList<Location>.



来源:https://stackoverflow.com/questions/6360224/android-couldnt-find-import-for-class-java-util-arraylist-in-aidl-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!