Path to file in Android Eclipse project
I need to use map rendering library in my android project. I want to use code found in mapsforge website. First, I must set the map I want to use. Method to do that is setMapFile(String newMapFile) from MapView class. I tried to place map file in assets and res/raw folder in Eclipse project and then give path to it, but it doesn't work for me. Could anyone tell me how to correctly deliver path with map to this map?
You'll have to place the map files on the SD card and access them as described in GettingStartedMapView. One of the mapsforge developers answers a similar question on mapsforge-dev Google Groups explaining why map files can not be placed inside the app (i.e. in the assets or res folder): [...] The problem is, that a java.io.RandomAccessFile instance is needed in order to read the map data from a binary map file. Just having an InputStream is not enough, as it doesn't have a seek() method. Calling skip(n) is not the same. In worst case all n bytes will be read, which is not an option for huge map files. Unfortunately, Android does not offer seekable file access on resources. That is due to the way all resource files are packaged and compressed into one .apk file. A quick Google search reveals that many other people are having the same problem. One work around may be to copy the file to the SD card or internal phone filesystem when your application is started for the first time. See: http://groups.google.com/group/android-developers/browse_thread/thread/59b6bf70ca6d2081 But depending on the file size, this copying process may take a longer time. Having map files bundled with your application will also increase the size of your APK file a lot. Another disadvantage is that the map file can no longer be updated separately or copied to other devices.
Value <br of type java.lang.String cannot be converted to JSONObject on android
Connecting to existing Google Chromecast Session from Android (for generic remote control)
Create shortcut with data
4.4.2 Layout Call Issue (Eclipse)
Lint does not find an Activity from a Library
Running multiple instance of a service
How to update sqlite database using given username not by id . .I tried with below code but its not working
Parse special characters in json response from webservices android
How to zoom image in alert dialog
I am trying to export a single contact from the address book to .vcf. Where am I going wrong?
Orange triangle in the target column of Android Device Chooser window
How to prevent users from taking screenshots on android devices version < 3.0
Where Clause in Sql Android
Android Lock Pattern Errors
android.view.ViewRoot$CalledFromWrongThreadException in badge view
JSON to parse data into android application