开发者

Android mapview partially loading tiles

I have built an android application which has a single mapview.

I have a bug where the map view occasionally has missing tiles. The map view is not completely blank some tiles appear but not all of them. All the answers here relate to API Keys or issues with having multiple mapviews in one app. This is not the problem.

It occurs intermittently, approximately one in every five times I start the application after clearing all data out of the app. So its typical seen on new installations.

It only occurs on Android 2.2 devices (Samsung Galaxy S definately)

Note the logs show:

07-21 17:11:52.274: INFO/MapActivity(25951): Handling network change notification:CONNECTED
07-21 17:26:25.629: ERROR/MapActivity(26064): Couldn't get connectio开发者_如何转开发n factory client

When the tiles fail to load zooming in and out or restarting does not refresh the tiles. Only solution is to go to Settings->Manage Applications->[select app]->Clear data then restart the app.

Anyone seen this before and know of the cause or workaround?

Cheers.


I can guess that you can see partial tiles so may be your internet connection problem. Check your Internet connection weather it displays 3G icon in emulator if you are trying to run your app in emulator else check in device.

I had found same problem as you because when I had connection some part of map displayed and after some time i had opened it again and at that time i had not internet so I had found partial tiles on map which was loaded at the first time.I had connect to internet and try again then my issue is solved map displays fine.


Suggestion

public class yourCustomMapView extends MapView{
    public abstract void invalidateDrawable (Drawable who){
        super.invalidateDrawable(who);
        //try to catch the error here:
        //My Guess is the following:
        if(who.getTransparentRegion!=null){
            //DO SOMETHING
            //You would delete the cache and reload
            //Try Reloading the image only
        }
    }
}

Deleting the cache programmatically

This is the easier part. You will have manually to delete all the databases and files associated with your application. Do not forget to close databases and streams to files before deleting. This is if it turns out that you have to clear the cache.


It can happen if the network connection is not proper. I mean if there is any problem from network provider side. It happend for me too. Just run the app after some time. I hope it may solve problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜