地图应用上的Android异常

时间:2012-11-23 09:28:44

标签: android google-maps exception

我的Android应用程序基于地图,存在于谷歌播放,用户实验崩溃 当gps本地化正在搜索时似乎出现了一次。 这里有2个用户发送给我的例外:

class:java.util.ConcurrentModificationException 方法:ArrayList $ ArrayListIterator.next()

堆栈:

java.util.ConcurrentModificationException
    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576)
    at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
    at com.google.android.maps.MapView.onDraw(MapView.java:530)
    at android.view.View.draw(View.java:6970)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1971)
    at android.view.ViewRoot.draw(ViewRoot.java:1600)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:1321)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:4277)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

在模拟中它并不适用。有什么想法吗?

提前Tx。

编辑路易斯怀疑我的帖子有问题:

    public void onLocationChanged(Location location) {
    // TODO Auto-generated method stub
    Log.d(TAG, "onLocationChanged with location " + location.toString());
    // Displays lat, long, altitude and bearing
    String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getBearing());
    this.locationText.setText(text);


    try {
        // This gets a list of addresses 
        List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 10);
        for (Address address : addresses) {
            this.locationText.append("\n" + address.getAddressLine(0));
        }

        // Convert latitude and longitude into int that the GeoPoint constructor can understand
        int latitude = (int)(location.getLatitude() * 1000000);
        int longitude = (int)(location.getLongitude() * 1000000);

        GeoPoint point = new GeoPoint(latitude,longitude);
        mapController.animateTo(point);

    } catch (IOException e) {
        Log.e("LocateMe", "Could not get Geocoder data", e);
    }
}
}

1 个答案:

答案 0 :(得分:1)

您是否在代码中使用线程?

看起来你的一个线程试图在覆盖列表中添加一些内容,而MapView类正在迭代它以绘制它们。

您需要发布相关代码才能得到更具体的答案。

问候。