如果我在 .png.tile 中有图 block 。是否可以将其包含在 .apk 中。 我的目的是在我从市场下载应用程序后,当我打开应用程序时,它应该显示至少 1 个国家(可能不是大国家)的每个图 block 和每个缩放级别。 附言。我使用 OSM。 PS.2 对不起我的英语语法。
编辑:一个国家可能太大了。 也许只是一个省或一个州和一些缩放级别。
EDIT2:这是我使用的功能,我可以对输入流做些什么,非常感谢。
AssetManager assetManager = getAssets();
try {
files = assetManager.list("Map");
} catch (IOException e) {
Log.e("tag", e.getMessage());
}
try {
firstField = (EditText) findViewById(R.id.firstId);
firstField.setText(Integer.toString(files.length)
+ " file. File name is " + files[0]);
} catch (Exception e) {
e.printStackTrace();
}
try {
inputStream = assetManager.open("Map/mapnik.zip");
// String s = null;
// s = readTextFile(inputStream);
// secondField = (EditText) findViewById(R.id.secondId);
// secondField.setText(s);
} catch (IOException e) {
Toast.makeText(this, "Error" + e.toString(), Toast.LENGTH_SHORT)
.show();
}
最佳答案
是的,您可以通过将其放在 Assets 文件夹中来包含它。参见 http://developer.android.com/reference/android/content/res/AssetManager.html用于访问 Assets 。
关于android - 离线 map 包含在 .apk 文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9577090/