Maps and Map Overlays - ConcurrentModificationException and OutOfMemoryError

by Sripati » Thu, 02 Sep 2010 02:00:25 GMT


Sponsored Links
 i,

If i happen to be moving the map, or zooming the map when update
occurs I got the exceptions. Sometimes getting 1)
ConcurrentModificationException and sometimes getting 2)
OutOfMemoryError. Please anybody have any solution let me know. This
is very critical position.

Logcat : ConcurrentModificationException
________________________________________

09-01 10:38:38.466: ERROR/AndroidRuntime(1840):
java.util.ConcurrentModificationException
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at java.util.ArrayList
$ArrayListIterator.next(ArrayList.java:573)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
com.google.android.maps.MapView.onDraw(MapView.java:494)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.View.draw(View.java:6740)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.View.draw(View.java:6743)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.View.draw(View.java:6743)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.View.draw(View.java:6743)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.draw(PhoneWindow.java:1842)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewRoot.draw(ViewRoot.java:1407)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.os.Looper.loop(Looper.java:123)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
android.app.ActivityThread.main(ActivityThread.java:4627)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
java.lang.reflect.Method.invokeNative(Native Method)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
java.lang.reflect.Method.invoke(Method.java:521)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-01 10:38:38.466:



Maps and Map Overlays - ConcurrentModificationException and OutOfMemoryError

by TreKing » Thu, 02 Sep 2010 02:08:22 GMT


 





java.util.ConcurrentModificationException

09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at java.util.ArrayList

$ArrayListIterator.next(ArrayList.java:573)

09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at

com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)

09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at

com.google.android.maps.MapView.onDraw(MapView.java:494)

09-01 10:38:38.466: ERROR/AndroidRuntime(1840): at

android.view.View.draw(View.java:6740)


You're trying to modify the contents of an ArrayList concurrently ... don't
do that. Synchronize the access to the list. Somewhere you have a thread
that is trying to update the list at the same time the draw method is
iterating over the items.





You're running out of memory trying to create a bitmap. Looks like this is
in the bowels of the maps library and is not surprising - it's horribly
buggy. Not sure what you can do about that one. If you can reproduce the
issue reliably, submit a bug report.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--


Sponsored Links


Other Threads

1. how to load intro while setting up huge database

Hi guys,

I'm implementing the app requires database set-up when installed for
the first time.

It works fine however it takes a couple of minutes wait with black
screen (default screen) while establishing database.

I understand that is necessary but would like to treat more elegant
approach for User Interface.

I'm using DatabaseHelper class inherited from SQLiteOpenHelper to
initiate database for the first time.

Here is snippet for your understanding.

================================================
private static class DatabaseHelper extends SQLiteOpenHelper

        {
                private Context dbContext;

                DatabaseHelper(Context context)
                {
                        super(context, DATABASE_NAME, null, DATABASE_VERSION);
                        dbContext = context;
                }

                @Override
                public void onCreate(SQLiteDatabase db)
                {
                        db.execSQL(DATABASE_CREATE);
                        ContentValues values = new ContentValues();
                        loadDB(db, values);
                }

                @Override
                public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
                {
                        Log.w(TAG, "Upgrading from " + oldVersion + " to " + 
newVersion);
                        db.execSQL(DATABASE_DROP);
                        onCreate(db);
                }


                private void loadDB(SQLiteDatabase db, ContentValues values)
                {
                        // establishing database here.
                       // it takes a couple of minutes but would like
to handle with more elegant way.
                }
}

====================================================================

loadDB() method needs operation with more sophisticated approach so
any idea or advise will be welcome.

Thanks.

-- 

2. How to make an efficient rendering loop with cache-based scrolling/zooming

Does anybody have any ideas on this?

-- 

3. Calling a system service in fixed intervals within another service

4. Flash Player Browser

5. Motorola Droid Pro gak mau SMS

6. [WTA] Kelebihan and kekurangan android CDMA

7. [WTA] Samsung Galaxy S II