Hi.
Is it possible that B4A could implement the Activity onDestroy() method?
I was hoping to create a B4A library around the Android mapsforge library.
Unfortunately, a mapsforge MapView must be used within a mapsforge MapActivity.
I wanted to create a library much like my OSMDroid library where a mapsforge MapView could be added to a B4A Activity just as any other view is added.
I don't want to create a pre-compiled MapActivity (in Eclipse) and add it to a B4A project.
So i've looked as the mapsforge MapActivity to see where it differs from the standard Activity class.
MapActivity overrides the Activity onDestroy, onPause and onResume methods.
I can take the MapActivity code from onPause and onResume and add it to the B4A library and then the B4A project can call that code in it's Activity onPause and onResume methods.
If B4A implemented the onDestroy method then i could also take the MapActivity onDestroy code and add it to the B4A library and then the B4A Activity could call it onDestroy.
I could then do away with the mapsforge MapActivity and make a standalone mapsforge MapView that could be added to a B4A Activity - just as other B4A Views are added to a B4A Activity.
A workaround would be to call the code that must be executed in onDestroy in the onPause method.
I think that would work but it'd be inefficient - MapViews would be destroyed when sometimes there is no need to destroy them.
For example let's say i have started B4A Activity #1 displaying a MapView and the user clicks a button to start B4A Activity #2 and then returns to B4A Activity #1.
Activity #1 would be paused but not destroyed when Activity #2 is started, and then Activity #1 would be resumed when Activity #2 is exited.
There is no need to destroy the MapView in Activity #1 when it is paused - when Activity #1 is resumed, the MapView would no longer exist.
The workaround might work but it would be an inelegant hack - interfering with the standard Activity lifecycle.
Anyway - enough detail - is there any way a future B4A update could implement onDestroy()?
Martin.
Is it possible that B4A could implement the Activity onDestroy() method?
I was hoping to create a B4A library around the Android mapsforge library.
Unfortunately, a mapsforge MapView must be used within a mapsforge MapActivity.
I wanted to create a library much like my OSMDroid library where a mapsforge MapView could be added to a B4A Activity just as any other view is added.
I don't want to create a pre-compiled MapActivity (in Eclipse) and add it to a B4A project.
So i've looked as the mapsforge MapActivity to see where it differs from the standard Activity class.
MapActivity overrides the Activity onDestroy, onPause and onResume methods.
I can take the MapActivity code from onPause and onResume and add it to the B4A library and then the B4A project can call that code in it's Activity onPause and onResume methods.
If B4A implemented the onDestroy method then i could also take the MapActivity onDestroy code and add it to the B4A library and then the B4A Activity could call it onDestroy.
I could then do away with the mapsforge MapActivity and make a standalone mapsforge MapView that could be added to a B4A Activity - just as other B4A Views are added to a B4A Activity.
A workaround would be to call the code that must be executed in onDestroy in the onPause method.
I think that would work but it'd be inefficient - MapViews would be destroyed when sometimes there is no need to destroy them.
For example let's say i have started B4A Activity #1 displaying a MapView and the user clicks a button to start B4A Activity #2 and then returns to B4A Activity #1.
Activity #1 would be paused but not destroyed when Activity #2 is started, and then Activity #1 would be resumed when Activity #2 is exited.
There is no need to destroy the MapView in Activity #1 when it is paused - when Activity #1 is resumed, the MapView would no longer exist.
The workaround might work but it would be an inelegant hack - interfering with the standard Activity lifecycle.
Anyway - enough detail - is there any way a future B4A update could implement onDestroy()?
Martin.