GoogleMaps in FragmentActivity AndroidStudio - android

I'm developing an app using Android sdk version 29. I want to add Google Maps in one of my Fragments Activity but its not working and i couldnt fix it.
fradment_map.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jHumildes.beautyappointment.Fragments.MapFragment">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/mapAPI"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
MapFragment.java
public class MapFragment extends Fragment implements OnMapReadyCallback {
GoogleMap mapAPI;
SupportMapFragment mapFragment;
public MapFragment() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_map, container, false);
return view;
}
#Override
public void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
.findFragmentById(R.id.mapAPI);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mapAPI = googleMap;
LatLng Dublin = new LatLng(53.3581716, -6.2595678);
mapAPI.addMarker(new MarkerOptions().position(Dublin).title("Dublin"));
mapAPI.moveCamera(CameraUpdateFactory.newLatLng(Dublin));
}
}
I have implemented the libraries and also added uses-permissions in manifest.

implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.maps.android:android-maps-utils:0.4+'
...
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDI-Hx6qi9dEkuGZL_c2sMMg-Cm2wd7wNg" />
</application>
map fragment
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:layout_editor_absoluteX="58dp"
tools:layout_editor_absoluteY="257dp" />
map class:
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.onCreate(savedInstanceState);
mapFragment.onResume();
try {
MapsInitializer.initialize(getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
mapFragment.getMapAsync(new OnMapReadyCallback() {
#Override
public void onMapReady(GoogleMap mMap) {
googleMap = mMap;
googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
public void onMapClick(LatLng point) {
// Drawing marker on the map
}
});
googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
#Override
public void onInfoWindowClick(Marker marker) {
// TODO Auto-generated method stub
}
});
googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
#Override
public boolean onMarkerClick(final Marker marker) {
DetailData(String.valueOf(marker.getTag()));
tag = String.valueOf(marker.getTag());
name = marker.getTitle();
return false;
}
});
}
});

Related

Not able to show map marker in android

I want to add map marker in my map. I have a fragment in which I want to show map marker. I have added 'com.google.android.gms:play-services-maps:10.0.1' in my app's gradle. But I an having error i.e.
android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class fragment
// xml file code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="#dimen/dp176"
android:name="com.google.android.gms.maps.SupportMapFragment" />
</LinearLayout>
// code for map
public class KantorenOfficeDetailsFragment extends Fragment implements View.OnClickListener, OnMapReadyCallback {
GoogleMap googleMap;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_kantoren_office_details, container, false);
setUpMapIfNeeded();
return v;
}
private void setUpMapIfNeeded() {
if (googleMap == null) {
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
if (googleMap != null) {
setUpMap();
}
}
}
private void setUpMap() {
googleMap.addMarker(new MarkerOptions().position(new LatLng(22.7253, 75.8655)).title("Indore")); // here is marker Adding code
}
}
you are not initialize you googleMap object.
MapFragment Initialize must like this
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mapFragment= (MyMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
else
mapFragment= (MyMapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
and then import the callback method
#Override
public void onMapReady(GoogleMap map) {
googleMap = map;
}
call this setUpMap in inside callback method
if (googleMap != null) {
setUpMap();
}
Your OnMapReady Must be like
#Override
public void onMapReady(GoogleMap map) {
googleMap = map;
if (googleMap != null) {
setUpMap();
}
}
Hope it will help you

Map Return NULL

When Application run always return NULL Exception
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.MapFragment.getMapAsync(com.google.android.gms.maps.OnMapReadyCallback)' on a null object reference
if (map == null) {
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(new OnMapReadyCallback() {
#Override
public void onMapReady(GoogleMap googlemap) {
// TODO Auto-generated method stub
map=googlemap;
// startMap();
}
});
}
Xml Code is here where i used Map *
<fragment
android:id="#+id/map"
class="com.shahi.driver.locationfiles.TouchableMapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
Your class will be:
public class YourActivity extends Activity implements OnMapReadyCallback {
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.your_layout);
try {
// Loading map
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
} catch (Exception e) {
e.printStackTrace();
}
}
#Override
protected void onResume() {
super.onResume();
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(final GoogleMap googleMap) {
final LatLng current_position = new LatLng(your_latitude, your_longitude);
MarkerOptions marker = new MarkerOptions().position(current_position).title("Your Address").snippet("Anything");
googleMap.addMarker(marker);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(current_position, 12));
googleMap.getUiSettings().setMapToolbarEnabled(true);
googleMap.setMyLocationEnabled(true);
}
}
and your_layout.xml will be:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
This should work:
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng location = new LatLng(latitude, longitude);
mMap.addMarker(new MarkerOptions().position(location ).title("Marker in location "));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Then your xml:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.polaris.project_x.MapsActivity" />
I can see you have used custom Map Fragment on your XML code. By searching through its name I chanced upon its code on GitHub.
The issue on your code is that you are trying to get MapFragment from your layout but your Custom Map code is extending SupportMapFragment.
So to make your code work change your MapFragment to SupportMapFragment.
SupportMapFragment mapFragment = (SupportMapFragment) getFragmentManager()
.findFragmentById(R.id.map);
Also if your BaseActivity is extending AppCompatActivity then use getSupportFragmentManager() instead of getFragmentManager().

How to get marker position when drag googleMap in android

In my application i set one image in my layout center of map, and i want when drag googleMap show latLong of this image (marker).
layout code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/mainToolbar"
layout="#layout/toolbar_main" />
<fragment
android:id="#+id/mainMap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/mainToolbar"
tools:context="com.tida.utils.safine.Activities.MainActivity" />
<ImageView
android:id="#+id/location_setter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/ic_location_origin_pin" />
</RelativeLayout>
Java code:
public class MainActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private UiSettings mUiSettings;
private CameraUpdate mapCenter, mapZoom;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.mainMap);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mUiSettings = mMap.getUiSettings();
mUiSettings.setScrollGesturesEnabled(true);
mUiSettings.setZoomGesturesEnabled(true);
mUiSettings.setTiltGesturesEnabled(true);
mUiSettings.setRotateGesturesEnabled(true);
/*Set center of Tehran location*/
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(35.724414, 51.427059), 18.0f));
/*Map listener*/
mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() {
#Override
public void onMarkerDragStart(Marker marker) {
Log.e("mapDrag", "DragStart : " + marker.getPosition());
}
#Override
public void onMarkerDrag(Marker marker) {
Log.e("mapDrag", "Drag : " + marker.getPosition());
}
#Override
public void onMarkerDragEnd(Marker marker) {
Log.e("mapDrag", "DragEnd : " + marker.getPosition());
}
});
}
}
How can i set my image for marker and get this position ?
marker.getPosition() returns LatLng
you should use:
marker.getPosition().latitude
&
marker.getPosition().longitude
set marker using global variable of marker and call mMarker.setPosition(marker.getPosition());

Marker is not working(not exact location is displaying), only world Map is visible in Frgament

CustomMapFragment
public class CustomMapFragment extends SupportMapFragment {
public static final LatLng NurissLife = new LatLng(28.602012, 77.098750);
private SupportMapFragment supportMapFragment;
#Override
public void onActivityCreated(Bundle bundle) {
// FragmentManager fm=getChildFragmentManager();
supportMapFragment=SupportMapFragment.newInstance();
//supportMapFragment=(SupportMapFragment)getChildFragmentManager
//().findFragmentById(R.id.map_container);
supportMapFragment.getMapAsync(new OnMapReadyCallback() {
#Override
public void onMapReady(GoogleMap googleMap) {
googleMap.addMarker(new MarkerOptions().position
(NurissLife).title("Nuriss LifeCare"));
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom
(NurissLife, 15));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000,
null);
}
});
super.onActivityCreated(bundle);
}
}
Fragment xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map_content"
tools:context="com.demo.stuartabhi.nurisslife.Fragment.ContactFragment">
<!-- TODO: Update blank fragment layout -->
<FrameLayout
android:layout_width="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_height="match_parent"
android:id="#+id/map_container">
</FrameLayout>
</FrameLayout>'
Marker is not working(exact location is not displaying), only world Map
is visible in Fragement
OnMapReady is not working either showing
no error in log, location code being described in OnMapReady method.
Please help regarding this, how to access the described location LatLng NurissLife inside SupportMapFragment.
Thanks in advance.
If you extend SupportMapFragment, there is no need to inflate any xml layout. Just call this.getMapAsync() in order to get a reference to the GoogleMap:
public class CustomMapFragment extends SupportMapFragment implements
OnMapReadyCallback {
private GoogleMap mMap;
public CustomMapFragment() {
}
#Override
public void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
if (mMap == null) {
getMapAsync(this);
}
}
#Override
public void onMapReady(GoogleMap googleMap) {
Log.d("MyMap", "onMapReady");
mMap = googleMap;
mMap.addMarker(new MarkerOptions().position(NurissLife).title("Nuriss LifeCare"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(NurissLife, 15));
mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
}
}
Try this:
Create a method getCustomMapFragment() in your Activity class like this:
private SupportMapFragment getCustomMapFragment(){
SupportMapFragment supportMapFragment;
supportMapFragment= SupportMapFragment.newInstance();
supportMapFragment.getMapAsync(new OnMapReadyCallback() {
#Override
public void onMapReady(GoogleMap googleMap) {
googleMap.addMarker(new MarkerOptions().position
(NurissLife).title("Nuriss LifeCare"));
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom
(NurissLife, 15));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000,
null);
}
});
return supportMapFragment;
}
And when you perform your FragmentTransaction, try this:
...
transaction=getChildFragmentManager().beginTransaction();
transaction.add(R.id.map_container,getCustomMapFragment()).commit();
...
Also, with this implementation, the class="com.google.android.gms.maps.SupportMapFragment" line in your XML might be unnecessary.

Google Map won't display markers

Started working with Android Studio, trying to display a Google Map in a fragment. The maps displays fine and I'm able to zoom/move the map around, but my markers will not display.
Here is my MapsActivity (HomePageMapsActivity.java):
public class HomePageMapsActivity extends FragmentActivity {
private GoogleMap mMap; // Might be null if Google Play services APK is not available.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page_maps);
setUpMapIfNeeded();
}
#Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
/**
* Sets up the map if it is possible to do so, and the map has not already been instantiated.
* If not installed {#link SupportMapFragment} (and
* {#link com.google.android.gms.maps.MapView MapView}) will prompt user to
* install/update the Google Play services APK on their device.
*/
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
/**
* This is where we can add markers, lines, listeners, or move the camera.
* Only call once and when sure {#link #mMap} is not null.
*/
private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(33, -84)).title("Atlanta"));
}
}
The xml (activity_home_page_maps.xml):
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
tools:context="net.datanetics.campusresponseapp.HomePageMapsActivity" />
The home page xml (activity_home_page):
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/HomePageMap"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9"
tools:context=".HomePageMapsActivity"
class="com.google.android.gms.maps.SupportMapFragment" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="1" >
<Button
android:id="#+id/MenuButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#3498DB"
android:text="Menu"
android:textColor="#FFFFFF" />
<Button
android:id="#+id/EmergencyButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#C1392B"
android:text="Emergency"
android:textColor="#FFFFFF" />
</LinearLayout>
Are you sure, your GoogleMap is not null? Try to get map asynchronously:
public class YourActivity extends AppCompatActivity implements OnMapReadyCallback {
private GoogleMap mMap;
SupportMapFragment fragMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page_maps);
fragMap = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
fragMap.getMapAsync(this);
}
#Override
public void onMapReady(final GoogleMap map) {
if (map != null) {
mMap = map;
setUpMap();
}
}
}
Two things:
1) You are trying to use the map too early. You need to have the view
first, so your code should be in onCreateView() not onCreate().
Correction: onCreateView() applies to fragments, not activities.
The app I used to test this used a Fragment to hold the map, not a
FragmentActivity.
2) I found I needed to prod the initialization of the map layers by
calling mMapView.onCreate() and mMapView.onResume() explicitly. See
also JoelLipman.com.
public class HomePageMaps extends SupportMapFragment {
private View mView;
private View mMapView;
private GoogleMap mMap;
#Override public View onCreateView(LayoutInflater inflater, ViewGroup group, Bundle state) {
super.onCreateView(inflater, group, state);
mView = inflater.inflate(R.layout.activity_home_page_maps, group, false);
mMapView= (MapView)mView.findViewById(R.id.map);
mMapView.onCreate(state);
mMapView.onResume();
mMap= mMapView.getMap();
mapUpdate();
return (mView);
}
private void mapUpdate() {
LatLng myLoc= new LatLng(33,-84);
MarkerOptions opt = new MarkerOptions();
mMap.clear();
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLoc, 15));
mMap.addMarker(opt.position(myLoc).title("Me"));
}
}
I got your issue change this line
mMap.addMarker(new MarkerOptions().position(new LatLng(33, -84)).title("Atlanta"));
to
mMap.addMarker(new MarkerOptions().position(new LatLng(33.7550,84.3900)).title("Atlanta"));
you have to pass the double value in lat and lng.
I found my "FirstMap" project, hope it helps. You will want to
move your map into a fragment sooner rather than later.
MapsActivity.java
public class MapsActivity extends FragmentActivity {
private PageMap mPageMap;
public interface IAction {
boolean onClick(int BtnID);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPageMap= new PageMap();
setContentView(R.layout.activity_main);
}
public void onClick(View Ctrl) {
int BtnID= Ctrl.getId();
switch(BtnID) {
case R.id.MainBtn_Map: ShowMap(); break;
default: mPageMap.onClick(BtnID);
}
}
private void ShowMap() {
LoadPage(mPageMap);
}
public void LoadPage(Fragment NewPage) {
FragmentManager Mgr= getSupportFragmentManager();
FragmentTransaction Action= Mgr.beginTransaction();
Action.replace(R.id.Main_FragmentContainer,NewPage);
Action.show(NewPage);
Action.commit();
}
}
res/layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="#+id/MainBtn_Map"
android:onClick="onClick"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="Load Map"
/>
<LinearLayout
android:id="#+id/Main_FragmentContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/material_blue_grey_800"
>
</LinearLayout>
</LinearLayout>
PageMap.java
public class PageMap extends SupportMapFragment implements MapsActivity.IAction {
private FragmentActivity mActivity;
private MapView mMapView;
private GoogleMap mMap;
#Override public void onAttach(Activity parent) {
mActivity= (FragmentActivity)parent;
super.onAttach(parent);
}
#Override public View onCreateView(LayoutInflater inflater, ViewGroup group, Bundle instance) {
super.onCreateView(inflater,group,instance);
View view= inflater.inflate(R.layout.page_map,group,false);
mMapView= (MapView)view.findViewById(R.id.map);
mMapView.onCreate(instance);
mMapView.onResume();
mMap= mMapView.getMap();
return(view);
}
public boolean onClick(int BtnID) {
switch(BtnID) {
case R.id.PageMap_BtnUpdate: return (Update());
}
return (false);
}
private boolean Update() {
setUpMap();
return(true);
}
private void setUpMap() {
if(mMap!=null) {
LatLng loc = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(loc).title("Marker"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 15));
}
}
}
//EOF: PAGEMAP.JAVA
res/layout/page_map.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<Button
android:id="#+id/PageMap_BtnUpdate"
android:onClick="onClick"
android:text="Update"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<com.google.android.gms.maps.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
</LinearLayout>

Categories

Resources