I'm having problems with getting the map in my map fragment to show. I have tried several different solutions but the map remains blank (grey). Can somebody please point out what I'm doing wrong? The SHA1 fingerprint I'm using is the one I found in Android > Build.
Note: where it says "api key from developers console", I of course have put the correct key.
Fragment01.java
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.model.LatLng;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class Fragment01 extends Fragment {
MapView mapView;
GoogleMap map;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_01, container, false);
// Gets the MapView from the XML layout and creates it
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
// Gets to GoogleMap from the MapView and does initialization stuff
map = mapView.getMap();
map.getUiSettings().setMyLocationButtonEnabled(false);
map.setMyLocationEnabled(true);
// Needs to call MapsInitializer before doing any CameraUpdateFactory calls
MapsInitializer.initialize(this.getActivity());
// Updates the location and zoom of the MapView
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(43.1, -87.9), 10);
map.animateCamera(cameraUpdate);
return v;
}
}
Fragment01.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.gms.maps.MapView android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.sebastianliljegren.nellienovafoto"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="se.sebastianliljegren.nellienova.foto.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="se.sebastianliljegren.nellienovafoto.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="api key from developers console"/>
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<activity
android:name="se.sebastianliljegren.nellienovafoto.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
If you are getting a grey map it's a communication issue with the servers. Recheck your api key, did you activate google map in the google map console for ANDROID ? is your package name correct in the console ? Are you 100% sure ? If there is doubt ReCreate a debug apikey or release. Also if the map is grey there must be some log, check your logcat for warnings from the api
I had the same problem after change my Hard Disk.
My problem solved after I create New Api key whit New SHA1 on google console.
Related
I know there are a many questions on this topic. I have went to all of those questions and tried a lot of suggestions given in stack overflow and at other sites. But unfortunately, none has solved my problem.
When I am using MapView and MapsActivity, grid is displayed instead of maps. As suggested, I have regenerated API key and I have made sure that I have given the same package name as of my application, SHA1 key and I have enabled the Google Maps ApI for Android in the Credentials. I have given all the permissions, that are needed for maps, in Manifestfile.xml, my manifest file is as shown below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.samplemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MapsActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyClOHCG7SBYxg1o6YdUWhn03VSqWwE1y_g"/>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
My layout file:
<?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" >
<com.google.android.gms.maps.MapView android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
and my activity that extends MapActivity:
package com.example.mapsample;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class GoogleMaps_Sample extends MapActivity{
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.googlemapssample);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
When I use the above activity, grids are displayed. When I extends FragmentActivity instead of MapAcitivity and fragment instead of mapview, I have been getting an error saying unfortunately stopped and some times it says some fragment class error.
I have also installed Google API system image for the emulator I am using. I have downloaded Google Play Services too. But still, maps is not displayed to me. I have done almost everything as suggested in other questions.
What is the error or mistake in my application that is preventing maps to get displayed and that displays grid instead.
Thanks in advance.
Hello I'm doing an offline map.
I can't see the map tiles that I created from Mobile Atlas Creator. I'm using MapQuest and Tiel Format PNG, and it doesn't show any kind of problems and generates correctly the .APK
I tried all
I put my .zip file in /sdcard/osmdroid/
i changed my first folder inside of my .zip MapQuest by MapquestOSM
I reviewed my GeoPoint
But nothing functions for me...
My libs are the next...
android-support-v4.jar
osmdroid-android-3.0.7.jar
osmdroid-android-3.0.7-javadoc.jar
-slf4j-android-1.5.8.jar
my sources are:
MainActivity.java
package com.example.mapasasmdroid;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mapView = new MapView(this, 256); //constructor
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
setContentView(mapView); //displaying the MapView
mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
mapView.getController().setZoom(15); //set initial zoom-level, depends on your need
mapView.getController().setCenter(new GeoPoint(-16,528484,-68.109397));
//mapView.getController().setCenter(new GeoPoint(,));
mapView.setUseDataConnection(true);
mapView.setMultiTouchControls(true);
}
}
activity_main.xml
<RelativeLayout 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="${relativePackage}.${activityClass}" >
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapasasmdroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Please Help Me!! I really need this...
To fetch the map from your memory you are using this code:
map.setTileSource(TileSourceFactory.MAPQUESTOSM);
Therefore images stored in your device must be in the correct format and hierarchy which should be like this :
sdcard/osmdroid/tiles/MAPQUESTOSM/X/Y.png.tiles
You need to add Internet permissions to your android manifest:
<uses-permission android:name="android.permission.INTERNET" />
Then, at the end of onCreate, you need to add:
setContentView(mapView);
in order to show the view.
super.onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView map = (MapView) findViewById(R.id.mapview);
map.setUseDataConnection(true);
map.setTileSource(TileSourceFactory.MAPQUESTOSM); // Gets a server "valid" response.
map.setBuiltInZoomControls(true);
map.setMultiTouchControls(true);
// map.setUseDataConnection(true);//
GeoPoint startPoint = new GeoPoint( 27.72, 85.32);
IMapController mapController = map.getController();
mapController.setZoom(8);
mapController.setCenter(startPoint);
This is the activity_main 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" >
<org.osmdroid.views.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
and this is for manifest:
<uses-permission android:name="android.permission.INTERNET" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-feature android:name="android.hardware.location.network" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.wifi" />
What basically is the problem is that:
from Mobile atlas creator, the tiles are saved in .jpg format, whereas the auto downloading(caching) with OSMDroid library is downloading .png.tile format. So, all you need is to create tiles of .png.tile format and the setusedataconnection(false) and off the internet permission and it will automatically load data. Cheers
NB - I've been through this site with a fine toothed comb and can't find an answer that helps me. Though, this seems to be a common problem for whatever reason.
I'm a proper noob at Java, and I'm currently teaching myself. I'm working towards GeoFencing, but obviously need to learn about including Maps in my app first. I've tried so many things but I can't get a working Map to display, instead I get a blank outline of where a map should go and then some zoom buttons and a Google Logo. Can anyone point out what I'm doing wrong?
For the record:
I'm testing on Stock Galaxy S3 i9300 - 4.3
Included Google Play Services Library
Included android.support.v4.jar
Tried two different API keys
Tried multiple 'Project Build Targets' (both Android and Google ones_
I am however using the API key generated from degug.keystore. Would that cause a problem.
Thanks in advance :)
Manifest:
`
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="18" />
<permission
android:name="com.example.geofence1.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.geofence1.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"
/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyB81f5fwV0MPK9ZA6Y-ESt2Rq_0T76xF7I"/>
<activity
android:name="com.example.geofence1.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>`
Main_Activity.java:
package com.example.geofence1;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.Toast;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
public class MainActivity extends FragmentActivity {
// Google Map
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
// Loading map
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* function to load map. If map is not created it will create it for you
* */
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
#Override
protected void onResume() {
super.onResume();
initilizeMap();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
activity_main.xml:
<RelativeLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
I am running sample code that is provided on Google Map Documentation for Google Map Api v2 (https://developers.google.com/maps/documentation/android/start#specify_settings_in_the_application_manifest).
The code run successfully but Map is not loaded on the device. Only white screen is shown on the device. I am using 4.0.3 version Android device.
1) I enabled service for the project.
2) Generated key:
3) "google-play-services_lib" as Library in project:
4) Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCvZrhQ8YBfyYBvTic3DSdu2O06nAmhpg4" />
<activity
android:name="com.example.mapdemo.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
5) Activity:
package com.example.mapdemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
6) Layout:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
Use Fragment activity
eg:
public class Maps extends FragmentActivity {
GoogleMap map;
double lat;
double lan;
boolean flag = false;
// private LocationManager lm;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapptry);
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
}
}
Change ur map.xml to
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
EDIT
Got to do this also
import android.support.v4.app.FragmentActivity;
Before you do this Right click project->properties->buildpath->java build path -> libraries .. then click on add external jars
the go to
user\android-sdks\extras\android\support\v4
and select android-support-v4.jar
PS: Do all this provided your API key is correct . If you API key is wrong then also it shows only a white screen
try to add
GoogleMap googleMap = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
and replace your xml with
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
/>
you have added the following code outside application tag instead put it inside the tag
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
hope this might help someone who is facing the same problem
May be this problem with API key or you just check your SHA1 fingerprint in your project api console(https://console.developers.google.com/project) and your eclipse Windows -> Preferences -> Android -> Build are same, other wise just update the SHA1 from console to build path or vice versa.
Most probably your problem will be solved when you make sure below mentioned things:
Activate Google Map API
Use correct package name while generating API Key (in my case this was the mistake) .. and this seems problem to your case also as package name appears to be wrong (com.example.mapdemo)
Make Sure you are using the correct keystore file for generating the SHA1
Hope this will be helpful.
To maintain security for the system and users, Android requires apps to request permission before the apps can use certain system data and features. Depending on how sensitive the area is, the system may grant the permission automatically, or it may ask the user to approve the request.
https://developer.android.com/guide/topics/permissions/index.html
In case anyone else is as dumb as me... make sure the device you are testing on is connected to WiFi...
During my studies i must develop an application base on google maps, user should found QRcode on the map and scan them.
So i create an android application including ggogle play lib and including the sdk library. i suppose i have created the right api key in my account google console whith tha SHA1 of my computeur.
class java
package com.example.mapa;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
#SuppressLint("NewApi")
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
int i=0;
GoogleMap map=(SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
}
}
class XML
<RelativeLayout 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=".MainActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Manifest.XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapa"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_CORSE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission
android:name="com.example.mapa.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapa.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name="com.example.mapa.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key"/>
</application>
</manifest>
can every one can tel me why i have button on my map button i have a white screen all the time, with fragments or whithout, it's the same with a map view.
Maybe the while-loop is the problem? I don't see a change of i so this appears to be a infinite loop.
Try to get the reference to the GoogleMap in the onResume() method without a loop, like
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
I think you got the this Image.
At the moment, referencing the Google Android Map Api v2 you can't run google maps v2 on Android emulator; you must use a device for your tests.
I'm not sure if you didn't update the "my api key" value with your api key on purpose.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key"/>
And I don't remember seeing this in the docs, maybe you should remove it:
<uses-library android:name="com.google.android.maps"/>
Also COARSE_LOCATION is misspelled:
<uses-permission android:name="android.permission.ACCESS_CORSE_LOCATION" />
And you declared this twice. hehe. =)
<uses-permission android:name="android.permission.INTERNET"/>