mapfragment

How do I get the coordinates of a map on tap with MapFragment (not MapView)?

本秂侑毒 提交于 2019-12-04 02:24:35
I have searched around on how to get the coordinates of a location when the map is tapped. However, most, if not all the examples require a MapView as a parameter. For example: public boolean onTap(GeoPoint p, MapView map){ if ( isPinch ){ return false; }else{ Log.i(TAG,"TAP!"); if ( p!=null ){ handleGeoPoint(p); return true; // We handled the tap }else{ return false; // Null GeoPoint } } } @Override public boolean onTouchEvent(MotionEvent e, MapView mapView) { int fingers = e.getPointerCount(); if( e.getAction()==MotionEvent.ACTION_DOWN ){ isPinch=false; // Touch DOWN, don't know if it's a

Map of MapFragment gets loaded with lag when returning from another activity

我怕爱的太早我们不能终老 提交于 2019-12-03 17:15:01
问题 As far as I can see, MapFragment has an issue with transition animations. All views on the layout are getting shown immediately, including the MapFragment's own views (like zoom buttons). But the map itself gets loaded with a lag only after the animation is completed. In order to illustrate the problem, I did the following: I changed one of the Activities in the Google maps android API examples slightly. It opens a blank activity via an Action Item. When I click back button, the map gets

Differences between MapView, MapFrament and SupportMapFragment

时光怂恿深爱的人放手 提交于 2019-12-03 11:54:32
I would know the differences because I'm developing an app and I would introduce Google Map API v2 for compiling above Android 2.3. Which should I use? Ferdous Ahamed MapView: A View which displays a map (with data obtained from the Google Maps service). When focused, it will capture key-presses and touch gestures to move the map. Users of this class must forward all the life cycle methods from the Activity or Fragment containing this view to the corresponding ones in this class. Use it if you are going to add a map into a fragment . (you need to update each lifecycle to MapView). See Google

Map of MapFragment gets loaded with lag when returning from another activity

梦想与她 提交于 2019-12-03 06:16:58
As far as I can see, MapFragment has an issue with transition animations. All views on the layout are getting shown immediately, including the MapFragment's own views (like zoom buttons). But the map itself gets loaded with a lag only after the animation is completed. In order to illustrate the problem, I did the following: I changed one of the Activities in the Google maps android API examples slightly. It opens a blank activity via an Action Item. When I click back button, the map gets loaded, but only after the transition is completed. I exaggerated the transition effect a little bit, so

NulPointerException at maps.y.p.onResume(Unknown Source) on implementing fragments for OSMDroid

匆匆过客 提交于 2019-12-02 15:08:37
问题 I am currently trying to transfer my OSMDroid Map Activity into Fragments. It seems that everything has been set correctly but I'm getting this weird NullPointerException which I'm unsure of solving. 02-20 23:59:36.140: E/AndroidRuntime(970): FATAL EXCEPTION: main 02-20 23:59:36.140: E/AndroidRuntime(970): java.lang.NullPointerException 02-20 23:59:36.140: E/AndroidRuntime(970): at maps.y.p.onResume(Unknown Source) 02-20 23:59:36.140: E/AndroidRuntime(970): at com.google.android.gms.maps

NulPointerException at maps.y.p.onResume(Unknown Source) on implementing fragments for OSMDroid

[亡魂溺海] 提交于 2019-12-02 11:48:48
I am currently trying to transfer my OSMDroid Map Activity into Fragments. It seems that everything has been set correctly but I'm getting this weird NullPointerException which I'm unsure of solving. 02-20 23:59:36.140: E/AndroidRuntime(970): FATAL EXCEPTION: main 02-20 23:59:36.140: E/AndroidRuntime(970): java.lang.NullPointerException 02-20 23:59:36.140: E/AndroidRuntime(970): at maps.y.p.onResume(Unknown Source) 02-20 23:59:36.140: E/AndroidRuntime(970): at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:115) 02-20 23:59:36.140: E

findFragmentById always returns a null

旧时模样 提交于 2019-12-01 22:18:10
问题 I'm using an actionbar in navigation mode in the mainActivity. Different tabs has different layouts, and on one of these tabs, I embed a layout which has a MapFragment inside. With the following code, the app works well, the mapFragments works fine, the tabs works fine. However, once I want to get access the mapFragment embeded in myFragment use getFragmentManager().findFragmentById(R.id.map_add), I always get null. I've tried using FragmentManager and FragmentTransaction to add myfragment

Map fragment V2 in a Fragment

試著忘記壹切 提交于 2019-12-01 08:39:57
I am facing some issue"Null pointer Expcepttion at getmap()" in Google Map Fragments . I want to insert mapfragment in a fragment Please review the code and let know whether I am taking the right appraoch or not .. and let me know what exactly I need to do with my code to make it work My Layout file : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/bg2" android:weightSum="100"> <Button android:id="@

Map fragment V2 in a Fragment

亡梦爱人 提交于 2019-12-01 06:19:06
问题 I am facing some issue"Null pointer Expcepttion at getmap()" in Google Map Fragments . I want to insert mapfragment in a fragment Please review the code and let know whether I am taking the right appraoch or not .. and let me know what exactly I need to do with my code to make it work My Layout file : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android

Binary XML file line #8: Error inflating class fragment, Google Maps

拜拜、爱过 提交于 2019-12-01 02:05:07
问题 In this app, I am trying to add a functional V2 google map. I've looked at most of the tutorials for creating an activity, obtaining a key for the maps, and creating the xml file to try and see if I missed any step (I went through them like 4 times), and it doesn't seem like I missed any step. Here is the site I used: When I run my app on my phone(since Google play services doesn't work on the emulator), it gives me these two errors: 02-11 22:10:54.690: E/AndroidRuntime(4526): java.lang