[VTM] Multiple mapViews using different fragments

266 views
Skip to first unread message

Mathieu De Brito

unread,
Nov 7, 2016, 8:03:20 AM11/7/16
to mapsforge-dev
Hi Guys !

I'm having trouble using 2 different mapViews instances (using different prefs name) on 2 different fragments.
When I display the first mapView on a fragment, everything is OK, but when I add a new fragment using a new mapView, the 2 mapViews seems to merge somehow and it becomes unusable.

Do you have any idea to bugfix this plz ?

Best regards
merge.png

Emux

unread,
Nov 7, 2016, 8:07:00 AM11/7/16
to mapsfo...@googlegroups.com
There is an open issue about that, no solution yet.

--
Emux

Mathieu De Brito

unread,
Nov 7, 2016, 8:08:04 AM11/7/16
to mapsforge-dev
Oh thank you !
and sorry :p

Mathieu De Brito

unread,
Nov 8, 2016, 9:56:56 AM11/8/16
to mapsforge-dev
I could send a pull request with a sample of fragments, what do you think ?

Emux

unread,
Nov 8, 2016, 11:44:38 AM11/8/16
to mapsfo...@googlegroups.com
There is already an example with multiple map views.

The problem is not how map views are integrated in Android (with activities or fragments), but somewhere in VTM shared states among them.

--
Emux

Mathieu De Brito

unread,
Nov 8, 2016, 11:53:11 AM11/8/16
to mapsforge-dev
I just finished and pushed an example on my fork.

The problem using fragments seems not to be the same as using an activity :
- using the activity sample, we can actually use the map, there are rendering problems, but the map is still there.
- using fragments, the map above the other one does not seems to be drawn at all !

Do you want me to send the pull request or would you prefer testing it on my fork ?


Emux

unread,
Nov 8, 2016, 12:03:30 PM11/8/16
to mapsfo...@googlegroups.com
Since VTM can potentially work even on Android 10, any advanced code (e.g. fragments) could be avoided, at least to not limit users for now and keep Samples apk simple without 'support' dependencies.

In my tests, like mentioned in issue, depending on device there are crashes too.

We had tested two map views side by side.
Placing one on top of another (like an overview map), means two overlapping GLSurfaceView, that's of course a different story.

--
Emux

Mathieu De Brito

unread,
Nov 8, 2016, 12:23:27 PM11/8/16
to mapsfo...@googlegroups.com
I don't want to open the debate of VTM supporting Android 10 -> 18, but supporting fragments seems to be a stronger priority compared to supporting Android versions without fragments, am I wrong (Moreover, the supportCompat lib is there for assuming fragment compatibility) ?

If not, how could VTM be compatible with 'latest' Android versions if we can't test on it ? 

I can delete the example I made and not send the pull request if you want, but it seems to me that it would be a waste, no ?
You tell me what to do, you are the current VTM guru :)

Thanks anyway ;)

Mathieu De Brito

unread,
Nov 8, 2016, 12:30:28 PM11/8/16
to mapsfo...@googlegroups.com
BTW, thanks to your previous answer :

Adding setZOrderOnTop(true)to the latest mapView fixes the mapviews overlapping and bring us back to the main issue that we can view on the existing multimap example (Data seems to be shared between maps).
 -> This makes the pull request not necessary but still interesting for supporting 'latests' Android versions ;)

Emux

unread,
Nov 9, 2016, 2:24:42 AM11/9/16
to mapsfo...@googlegroups.com
You can create a new PR with fragments, using 1 map view and support-v4.

Multiple map views example exists already, let's keep that for showing VTM in fragments.

--
Emux

Mathieu De Brito

unread,
Nov 9, 2016, 5:19:58 AM11/9/16
to mapsfo...@googlegroups.com
Ok, just sent the PR, don't hesitate if anything's wrong
Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "mapsforge-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mapsforge-dev/OquEfCXY25g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mapsforge-dev+unsubscribe@googlegroups.com.
To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/683b0ce1-db53-baf7-a1b3-d60e7774f3b3%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

Andrey Novikov

unread,
Nov 14, 2016, 3:06:56 AM11/14/16
to mapsforge-dev
MapView on Android uses GLSurfaceView. GLSurfaceViews can not overlap:
https://groups.google.com/forum/#!topic/android-developers/COffLpanlz0

Reply all
Reply to author
Forward
0 new messages