0

我基于地图的 android 应用程序,出现在 google play 中,用户体验崩溃。
它似乎在搜索 gps 本地化时出现一次。这里有 2 个用户发送给我的例外:

类: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)

在模拟中它不会出现。有什么想法吗?

提前发送。

编辑 Luis 怀疑我的帖子有问题:

    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);
    }
}
}
4

1 回答 1

1

您在代码中使用线程吗?

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

您需要发布相关代码以获得更具体的答案。

问候。

于 2012-11-23T17:27:48.283 回答