哪个是存储在drawable文件夹中的文件的路径?

时间:2011-12-12 15:22:28

标签: android

  

可能重复:
  Android - get path of resource

我需要知道存储在drawable文件夹中的地图文件的字符串路径,因为我使用的是需要接收字符串路径的地图api,而我的地图必须存储drawable文件夹(资产文件夹不能是用于此,因为地图高于1MB)

这是我正在尝试的代码,但此代码不正确,因为地图未显示:

        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);

哪个是存储在我的drawable文件夹中的文件bremen.map的正确字符串路径文件?

1 个答案:

答案 0 :(得分:3)

您无法将文件存储在 drawables 文件夹中。此文件夹是打包应用程序的一部分。您需要将这些文件存储在其他位置(例如在设备的文件系统上)。