Closed westlinkin closed 10 years ago
You can create your own implementation of BitmapDecoder to decode tiles however you want, and set it with setTileDecoder
A BitmapDecoder is a pretty simple interface. It has a single public method that must be implemented - decode - that accepts a file name and a Context instance, and returns a Bitmap.
By default, the TileView will replace %col% and %row% in the pattern provided with the integer values of the column and row being rendered, but this can be overriden by a custom parser implementation, but if you don't have either of those strings in the pattern you pass to addDetailLevel, it won't matter.
Note that the tile view is looking for image tiles - so the example you posted would technically work, but it'd use that image for each tile - probably not what you want.
HTH, post back if you need more help.
Thanks, now I can load url as a tile.
And for all, it would be nice of you to post your code, this way it could be integrated to the project for other users :-D
Agree with @Tristus1er :)
FWIW, someone earlier posted an implementation of loading tiles via http - it's included at BitmapDecoderHttp, and can be used like
tileView.setTileDecoder(new BitmapDecoderHttp());
Of course, it could be implemented using a 3rd-party loader or something similar as well - as long as the BitmpaDecoder implementation returns a bitmap, you can get that bitmap any way you want.
Cool thank you for this.
My picture used in addDetailLevel(1f, "picture file path"), this picture file path is a url, like "http://i1.ytimg.com/vi/EukIx3XYTqI/mqdefault.jpg", how can I code this?