1

Possible Duplicate:
Android - get path of resource

I need to know the string path to a map file stored on drawable folder, because i'm using a map api that needs to receive a string path, and my maps must be stored drawable folder (assets folder can't be used for this because the maps are higher than 1MB)

This is the code i'm trying, but this code is incorrect because the map is not being displayed:

        MapView mapView = new MapView(this);
        mapView.setClickable(true);
        mapView.setBuiltInZoomControls(true);
        String mapName="bremen";           
        String fileName = "android.resource://" + this.getPackageName() + "/drawable/"+mapName;
        //mapView.setMapFile("/sdcard/path/to/mapfile.map");
        mapView.setMapFile(fileName);             
        setContentView(mapView);

Which is the correct string path file to the file bremen.map stored on my drawable folder?

Community
  • 1
  • 1
NullPointerException
  • 36,107
  • 79
  • 222
  • 382

1 Answers1

3

You can't store files in the drawables folder. This folder is part of the packaged application. You will need to store these files elsewhere (such as on the device's filesystem).

Phil
  • 35,852
  • 23
  • 123
  • 164