Android 自动完成的距离计算

Android 自动完成的距离计算,android,Android,我试图计算距离自动完成。并且在误差以下 protected void onPostExecute(List<HashMap<String, String>> result) { // Fetching i-th route List<HashMap<String, String>> path = result.get(i); } 编译器正在告诉您一切“类型不匹配:无法从Hash

我试图计算距离自动完成。并且在误差以下

protected void onPostExecute(List<HashMap<String, String>> result)
{
                   // Fetching i-th route
                List<HashMap<String, String>> path = result.get(i);
}

编译器正在告诉您一切
“类型不匹配:无法从HashMap转换为List>”

您试图将
HashMap
HashMap
分配到
List
时出错,这是不允许的

您应该使用以下选项

HashMap<String, String> path = result.get(i);
HashMap path=result.get(i);

路径应该是哈希映射,而不是列表
07-22 16:23:52.818: E/AndroidRuntime(12339): java.lang.ClassCastException: java.util.HashMap cannot be cast to java.util.List
HashMap<String, String> path = result.get(i);