Select to view content in your preferred language

activity gets killed when the mapview is disposed

3523
8
05-15-2012 05:32 AM
GwenRoyakkers1
Deactivated User
Hi,

my activity gets killed when the mapview is disposed.

I have an activity that uses the fragment api.

When there is a mapview on a fragment that is no longer necessary, the whole activity gets killed.

The last thing I can see in LogCat is:

05-15 14:51:18.490: W/EglHelper(3685): finish() tid=10
05-15 14:51:18.490: I/GLMapCore(3685): TexturesManager::releaseGraphicsHardwareResources
05-15 14:51:18.490: E/libEGL(3685): call to OpenGL ES API with no current context (logged once per thread)

after that the activity disappears without a trace.

When I remove the mapview from the fragment, everything works.


Something I noticed in my apps is that the activity is always killed immediately, when the activity isn't active.

Other activities without a mapview don't have this behaviour.

This also kills the activity when I rotate the device.

Any solution for this problem?
Or am i doing something wrong?

kind regards,
Gwen
0 Kudos
8 Replies
SimonKlein
Regular Contributor
My guess would be you are just simply running out of ressources. On a phone a MapView is taking quite a bit of your systems memory/cpu so if it is not in the currently visible activity the android system kills it to free up ressources for other activitys.
What device are you testing on? Task killer running? Any changed settings or so?

If you remove the MapView from the fragment, the android system does no longer need to kill it, because it just takes little memory etc. now.
0 Kudos
GwenRoyakkers1
Deactivated User
I am using a Samsung Galaxy tab10.1 with android 3.2.

The memory status before the app gets killed is around 314MB/724.

I have no task killer installed on the device.
(The device has default samsung settings, and it's used for development only.)

The problem is that when the fragment with the mapview is replaced, the whole activity is killed.
It's supposed to show an other fragment in the same activity.

When the fragment is needed again it should recreate it's resources.

To make sure where the problem arises I tried the following:

I made a function with the following code...

LinearLayout parent = (LinearLayout)mapview.getParent();
parent.removeView(mapview);
System.gc();

When this function is called, the app gets killed without going to onPause(), onStop() or onDestroy().
(the mapview is initialized and showing, it only contains an ArcgisLocalTiledLayer and a Graphicslayer)

the last thing logcat shows is: 05-16 08:38:46.330: E/libEGL(3132): call to OpenGL ES API with no current context (logged once per thread)

The only explanation I have for this behaviour, is that the mapview destroys the proces on wich the main activity runs when it is disposed.

Because of this, I can't use the activity or fragment lifecycle how it's supposed to be used.

Is there a way to stop this behaviour?
Or is this something that needs to change in the api?

Thanks

Kind regards,
Gwen
0 Kudos
RamaChintapalli
Esri Contributor
Saw the application crashing on rotation of tablet(if MapView is inside the fragment) with older NDK libraries. With the new NDK library the application does not crash.
[ATTACH=CONFIG]16819[/ATTACH]
0 Kudos
GwenRoyakkers1
Deactivated User
Saw the application crashing on rotation of tablet(if MapView is inside the fragment) with older NDK libraries. With the new NDK library the application does not crash.
[ATTACH=CONFIG]16819[/ATTACH]


Unfortunately the mapview still doesn't survive a FragmentTransaction...

11-08 10:54:12.140: I/MapCore(3253): TexturesManager::releaseGraphicsHardwareResources

11-08 10:51:59.980: E/MapCore(3148): TexturesManager::bindTexture FAILED, textureId = 8 out of range or not valid; m_texturesData.size =
11-08 10:54:19.050: I/DEBUG(105):          #00  pc 00211a62  /data/data/nl.kragten.android.knopenlopen/lib/libGLMapCore.so (_ZN6ArcGIS7Runtime4Core21SeqRenderBiColorPoint14startRenderingEPvRNS1_18VertexSequenceModeERSt6vectorIjSaIjEEPKNS1_7TextureEPNS1_24GraphicDisplayPropertiesERNS1_17SVerticesSequenceENS1_10RenderModeE)

Also there is a memory leak, every time you rotate, memory usage will increase.

Any workarounds or solutions?
Is there a planned release date for the next version of the sdk?

Thanks!
0 Kudos
JohnBuckland
New Contributor
Gwen_roy, you haven't by chance had any luck with this? I have a map in a fragment based activity as well, and I get this same error if I set the fragment to 'setRetainInstance(true);' and then rotate the screen. I am trying to handle processing of an async task during a screen rotation by using setRetainInstance 'setRetainInstance(true);' but I'm not sure that's going to work...
0 Kudos
ChristopherDonohue
Emerging Contributor
I am experiencing the same issue.
When I perform a fragment transaction like add() or attach() I get the following error and the entire application stops.
02-05 02:45:40.845: E/MapCore(19111): TexturesManager::bindTexture FAILED, textureId = 10 out of range or not valid; m_texturesData.size =
02-05 02:45:40.845: A/libc(19111): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 19382 (Thread-186)
0 Kudos
ChristopherDonohue
Emerging Contributor
Is there any workaround or solution for this? Is anyone from ESRI monitoring this thread?
0 Kudos
AndyGup
Esri Regular Contributor
I just saw this. I'm passing it back over to the support folks now for re-evaluation.

Are you using the latest SDK version 10.1.1?

-Andy
0 Kudos