Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps V2 android, the map is black
    primarykey
    data
    text
    <p>I have a problem with google maps. When i execute my aplication at the first time the map shows me normally, but when i close and execute again the screen of the map is black. I don't know what happens, but when i clean all the data of my application the map shown again.</p> <p>First time:</p> <p><img src="https://i.stack.imgur.com/WZAaO.png" alt="enter image description here"></p> <p>Second time (when i close the application and execute again)</p> <p><img src="https://i.stack.imgur.com/ZcG2q.png" alt="enter image description here"></p> <p>i'm using the virtual box with androidx86 project</p> <p>Can you help me?</p> <p>My code, where i set the map:</p> <pre><code>private void setUpMapIfNeeded() { if (map == null) { map = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); } if (map != null) { try{ map.setMyLocationEnabled(true); map.setOnMyLocationButtonClickListener(this); map.setOnMapLongClickListener(this); map.setOnMarkerClickListener(this); map.setOnMapClickListener(this); map.setOnCameraChangeListener(this); LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = locationManager.getBestProvider(criteria, true); Location location = locationManager.getLastKnownLocation(provider); if(location!=null){ double latitude = location.getLatitude(); double longitude = location.getLongitude(); LatLng latLng = new LatLng(latitude, longitude); //ThreadMostraImoveisJson(latLng); onLocationChanged(location); } } catch (Exception ex){ Log.e("Erro Mapa", "Erro Setar Mapa: "+ex.getMessage()); } } } </code></pre> <p>My Xml:</p> <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapHost" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;/fragment&gt; &lt;LinearLayout android:id="@+id/layPesquisa" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#f4f4f4" android:orientation="horizontal" android:layout_gravity="right"&gt; &lt;Button android:id="@+id/btnPesquisa" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="OK" /&gt; &lt;EditText android:id="@+id/edtPesquisa" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="invisible" android:text="" /&gt; &lt;/LinearLayout&gt; &lt;/FrameLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload