开发者

MapView rendering with tiles missing with an "x" in the center

This is very, very strange. I've never seen anything like it. At the time I am took this screenshot, I'm not loading any overlays. First, I thought it was my internet connection where it couldn't download the tile information; but we have many users reporting the same issue who downloaded from the market. Th开发者_如何学JAVAis just started happening like a week ago. Not sure why though. Anyone have a clue? Thanks!


MapView rendering with tiles missing with an "x" in the center


Ok. After starting from a clean project I found these two lines of code that was the culprit.

mapView.setSatellite(true);

mapView.setStreetView(true);

They appeared back to back of each other and I looked back at the very beginning of development and they were there and it worked just fine. Apparently, this is a BUG in the MapView as I'm guessing it tries to show both SateliteView and StreetView at the same time. One would think that the latter would override the former; but I guess not.

So, the question I have is, why this all of the sudden surfaced just within the last week or so. My guess is that the Maps Application was last updated in the market on Sept 8th and maybe a day or so after updating from the market, this issue started to resurface.

As a test, can someone just add these two lines to their code and confirm you get the same behavior?


I had only setStreetView(true) and getting those annoying grey boxes. I played around with both lines with no luck. Solved it by removing both setStreeView and setSatellite from my code, goes to streetview by default.


I had the same problem with my app that uses google maps library... Because i have in my setting option where user can change view of the map to Satelite or Street, i dont use setStreetView(true) at all...just mapView.setSatelite(true or false)...

preferences = PreferenceManager.getDefaultSharedPreferences(this);
        pogled = preferences.getString("list", "Street");

        if(pogled.equalsIgnoreCase("Street")){
            mapView.setSatellite(false);
            //mapView.setStreetView(true);
        }else if (pogled.equalsIgnoreCase("Satelite")) {
            mapView.setSatellite(true);
        }

As you can see i had mapView.setStreetView(true) but that gave me a headache... :D I hope this will help you...


I removed setStreetview(true) from my code and now its working fine i was saw this issue occured in last 2 weeks , nyway we finally solved the issue thats great


Street view is always considered as the default option. The problem arises when we use both setStreetView(true) and setSatellite(true) at the same time. Problem will be solved like this

    if(mapView.isSatellite()){
        mapView.setSatellite(false);
            }else{
            mapView.setStreetView(false);
            mapView.setSatellite(true);
            }

I hope that will help


private void setUpMapTypeScreen() {
    if (mapType.equalsIgnoreCase("Satellite")) {
        mapView.setSatellite(true);
        // mapView.setStreetView(false);
    } else if (mapType.equalsIgnoreCase("StreetView")) {
        mapView.setSatellite(false);
        // mapView.setStreetView(true);
    }
    mapView.invalidate();
}

mapType is a user defined string variable. Not false the previous view type when switching to view types. that the error we made, only set the view type you required.


I had the same problem, I took out my mapController, and it fixed it. The only other thing I did different was put the mapview in a linearlayout with a textview (it used to just be a mapview only) and I played around with the mapcontroller, commenting it out.

Since those are the only two things I changed, I'm pretty sure your problem lies in there as well.


I was having the same problem and the common advice that I have got is to not use setStreeView(true) and setSatellite(true) together. Some have even suggested not to use setStreetView(true) altogether. But my code was working okay before. I had to reinstall my machine and therefore installed android SDK and other components afresh after which this started happening. So my guess is that this is an issue with some specific version But I have found out that this problem occurs specific revision of 2.2 - in my case Android SDK Platform 2.2, revision 3. I have tried running same code on 2.3 and it works correctly i.e no grey boxes.


Besides removing mapController.setStreetView(true), there is also another thing that should be added to the layout XML..

xmlns:android="http://schemas.android.com/apk/res/android"

<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapa" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:apiKey="YOUR API KEY"
    android:clickable="true"></com.google.android.maps.MapView>

Note the xml namespace after com.google.android.maps.MapView. After adding the namespace, the cross tiles disappeared. Don't know if it's a bug or the namespace is necessary in order for the api render the map correctly. Either way, it worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜