该文件如下所示:
14.809034;56.876646;Vaxjo;
15.809035;57.906646;Vaxjo2;
16.809035;58.906646;Vaxjo3;
到目前为止代码在这里:
InputStream in = getResources().openRawResource(R.raw.cities);
if (in != null) {
InputStreamReader input = new InputStreamReader(in);
BufferedReader buffreader = new BufferedReader(input);
Pattern p = Pattern.compile(";");
Scanner del = new Scanner(buffreader);
del.useDelimiter(p);
while(del.hasNextLine()) {
while (del.hasNext()) {
city.add(new City(del.nextDouble(), del.nextDouble(), del.next()));
}
}
in.close();
} else {
}
我的输出只是第一行14.809034 56.876646 Vaxjo。其他线路怎么样?
答案 0 :(得分:4)
您是否也致电del.nextLine()
前往下一行?