My code for stored map:
final GeoMap jaredMap = new JaredOpenStreetMap(
"/res/drawable/maps/", 256, 10, 10);
jaredMap.setMissingTileImage(missingtile);
mapComponent.setMap(jaredMap);
This code work on J2ME, but on Android I get missingtile. I put all tiles zoom 10 for my country in /res/drawable/maps/. Does somebody know where is the problem?
| Failinimi | Suurus |
|---|---|
| MyJaredOpenStreetMap.java | 1.9 KB |
It is better to put maps on sdcard(for me), because android don't need to be signed like J2ME(problem with asking to read tiles). I try and it works.
How can I set zoom indicator to show only zoom level from 10 to 14, beacuse I will put maps only for this zoom level. I don't want to be posible to set zoom level for zoom I don't have maps. When I do this final GeoMap jaredMap = new JaredOpenStreetMap(
"/res/drawable/maps/", 256, 10, 14); only zoom from 10 to 14 is avaible. I also want this for stored maps on sdcard. I try this mapComponent.setZoomLevelIndicator(new DefaultZoomIndicator(10, 14)); but it is still posible to change zoom for all levels(0-17).
When I do this:
@Override
public void needRepaint(boolean mapIsComplete) {
mapView.needRepaint(mapIsComplete);
}
and run app, I get some error and app automatic close. When I comment one line of code in method above evrything is fine. Sholud I call some repaint method like in J2ME in needRepaint()?
Also, when I rotate screan I can't triger mapClicked method. Evrything is fine when I am in portrait, but when I am in landscape I can't triger. Even if I go back to portrait.
On my HTC wildfire (Android 2.1), when I rotate screan he first close app and then start it again in other orientation mode.
I solve this. MapLisener should be set outside of block if (savedMapComponent == null) {...}
I get message "Force close" when I try this:
mapComponent.addPlace(new Place(1, "milanko", img, new WgsPoint(xGPS, yGPS)));
Evrything is fine when I addLine:
WgsPoint[] a = new WgsPoint[2];
a[0]=new WgsPoint(xGPS, yGPS);
a[1]=new WgsPoint(xGPS-0.01, yGPS-0.01);
mapComponent.addLine(new Line(a));
Where is the problem? On J2ME it works. IMG is loaded with Utils.createImage().
I solve addPlace. The problem was that I create new folder in res/drawable and put images. From some reasion android can't address nothing in this folder. I can't start DDMS (some error), so I waste so many time for this!
I have put maps to /res/drawable/raw subdirectory and reference it as "/res/raw/" in the code. Android builders will do some magic with the resources and their subdirs. Second thing: Android SDK, at least in some versions, did not like if res file name starts with number (as in some point it tries to generate variable names from filenames), I have got compilation issues due to that. To avoid it I used application-provided JaredOpenStreetMap.java file. I attached it to the original post, maybe it helps you too. Only change is that files have "t" letter in the beginning.
/JaakL