如何获取Android路径字符串上绘制一个文件夹? [英] How to get the android String PATH to a file on drawable folder?
问题描述
我试图用API显示本地存储的地图来显示地图。
我需要知道字符串路径保存在文件夹中绘制的地图文件,因为我使用需要接收一个字符串路径的地图API,而我的地图必须存储绘制文件夹(资产文件夹不能与用于此,因为地图是大于1MB以上)
这是在code我想要的,但这种code不正确,因为没有被显示在地图:
图形页面图形页面=新的图形页面(本);
mapView.setClickable(真正的);
mapView.setBuiltInZoomControls(真正的);
字符串MAPNAME =不来梅;
字符串文件名=android.resource://+ this.getPackageName()+/绘制/+ MAPNAME;
//mapView.setMapFile("/sdcard/path/to/mapfile.map);
mapView.setMapFile(文件名);
的setContentView(图形页面);
至极是正确的路径字符串的文件存储在我的绘制文件夹中的文件bremen.map?
感谢
我需要知道字符串路径保存在文件夹中绘制的地图文件
有没有串路径保存在文件夹中绘制的地图文件,因为没有绘制文件夹,除了在开发计算机。
至极是正确的路径字符串的文件存储在我的绘制文件夹中的文件bremen.map?
有没有。
由于图形页面
没有 setMapFile()
,我假设你正在使用一些第三方实现。如果是这样,那实现是开源的,对其进行修改以支持乌里
除现有支持路径。
否则,绘制资源复制到一个文件,再提供一个路径,该文件。
I'm trying to display locally stored maps with a api to show maps.
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);
Wich is the correct string path file to the file bremen.map stored on my drawable folder?
Thanks
I need to know the string path to a map file stored on drawable folder
There is no "string path to a map file stored on drawable folder", because there is no "drawable folder" except on your development machine.
Wich is the correct string path file to the file bremen.map stored on my drawable folder?
There is none.
Since MapView
does not have setMapFile()
, I am assuming you are using some third party implementation. If so, and that implementation is open source, modify it to support a Uri
in addition to its existing support of a path.
Otherwise, copy the drawable resource to a file first, then supply a path to that file.
这篇关于如何获取Android路径字符串上绘制一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!