supportmapfragment

Google Map:onMapReadyCallback can not be applied to this activity

北慕城南 提交于 2021-01-28 05:01:57
问题 I am a beginner trying to use google maps, and I have followed the instructions given here: https://developers.google.com/maps/documentation/android-api/map?hl=zh-tw But I'm stuck at mapFragment.getMapAsync(this) and have been unable to find an answer. Here is the code: public class GoogleMapPage extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.googlemap); MapFragment mapFragment =

GoogleMap (Android) projection visible region not updated after orientation change?

戏子无情 提交于 2020-05-30 03:09:10
问题 When my SupportMapFragment onCreateView() method is called, I read the map's getProjection().getVisibleRegion().latLngBounds.northeast.x and getProjection().getVisibleRegion().latLngBounds.southwest.y The first time I launch the app (in portrait mode), I get x=720 and y=1230 . However, after changing the orientation to landscape I'm seeing the same values again. Going back to portrait mode yields x=1280 and y=670 (which is what I'd expect from landscape), and going back to landscape gives the

How to save information of markers of Map v2 so that it can be retrieve on marker click

末鹿安然 提交于 2020-01-23 03:19:27
问题 I am making an app which has map v2 and I am displaying multiple pins successfully. I have followed an tutorial which was just displaying the pin/markers on map v2. Through service I am getting information of Marker showing the Hotels location on map . The service is sending me the information which include Hotel Name, Location , Food , Services , rating and Latitude and longitude.so let me explain what I have done so far what I am doing is getting each hotel specification in my asynctask and

How to save information of markers of Map v2 so that it can be retrieve on marker click

与世无争的帅哥 提交于 2020-01-23 03:19:12
问题 I am making an app which has map v2 and I am displaying multiple pins successfully. I have followed an tutorial which was just displaying the pin/markers on map v2. Through service I am getting information of Marker showing the Hotels location on map . The service is sending me the information which include Hotel Name, Location , Food , Services , rating and Latitude and longitude.so let me explain what I have done so far what I am doing is getting each hotel specification in my asynctask and

SupportMapFragment on DialogFragment

岁酱吖の 提交于 2020-01-14 13:51:12
问题 I need to embed a SupportMapFragment in a Dialog . This is the best I could think of: public class SupportMapFragmentDialog extends DialogFragment { private final SupportMapFragment fragment; public SupportMapFragmentDialog() { fragment = new SupportMapFragment(); setTargetFragment(fragment, 1); } @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { return fragment.onCreateView(inflater, container, savedInstanceState);

Google map inside another fragment - Error when calling getMapAsync

十年热恋 提交于 2020-01-11 09:24:28
问题 I'm trying to convert a google map activity to work inside a fragment that will be called in NavigationView. The map is showing but when i used the code getMapAsync mFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map); mFragment.getMapAsync(this); I got an error message E/AndroidRuntime: FATAL EXCEPTION: main E/AndroidRuntime: java.lang.NullPointerException E/AndroidRuntime: at com.sample.samplemap.samplemapFragment.onCreate(samplemapFragment.java:32) E

Android InflateException Error in fragment layout with SupportMapFragment (recreated fragment)

烈酒焚心 提交于 2020-01-06 19:58:08
问题 All more or less works. But if the LocationFragment is recreated, the application falls. Manifest <?xml version="1.0" encoding="utf-8"?> <manifest package="XX.XX.XXXXXXXX" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.CAMERA"/>

fManager.getFragmentById() returns null

♀尐吖头ヾ 提交于 2020-01-05 09:34:36
问题 I asked a question like this one the other day... this. I marked it as resolved, because the mistake was that isPlayServicesAvailable() returned false, because I had not the up to date Google Play Services. I have them now...but still NPE. The code: GoogleMap map; FragmentManager fmanager = getSupportFragmentManager(); Fragment fragment = fmanager.findFragmentById(R.id.map);//after this, fragment is null SupportMapFragment supportmapfragment = (SupportMapFragment)fragment; map

how to get snapshot from Google Map V2

戏子无情 提交于 2019-12-24 00:34:57
问题 I am wondering to know about how to get snapshot from SupportMapFragment. I have no idea. Please help. Thanks for your advance. 回答1: You can try to take a screen shot of the fragment View: View view = findViewById(R.id.fragmentId); view.setDrawingCacheEnabled(true); Bitmap bitmap = view.getDrawingCache(); BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap); I haven't tested it. 回答2: To get a drawable you can implement this code: SnapshotReadyCallback callback = new

How to have the soft keyboard cover a view, yet cause other views to take the available space?

时间秒杀一切 提交于 2019-12-23 22:26:11
问题 Background Suppose I have a view that works as the background (MapFragment in my case), and some other views that are the content of the activity. The problem Focusing an EditText, it shows the soft keyboard, causing all views to change their sizes, including the background view. This means that showing the soft keyboard causes the background to "jump" and re-layout itself. This is especially problematic in my case, as I use MapFragment as the background. That's because I can think of a