Before the beginning of the text or first spit groove, a line of code debug a day do not know how to change, finally stumbled out (the following SHP file for example)
For virtual machine testing
1 PublicString GetPath () {2File Sddir =NULL;3 BooleanSdcardexit =environment.getexternalstoragestate (). Equals (Android.os.Environment.MEDIA_MOUNTED);4 if(sdcardexit) {5Sddir =environment.getexternalstoragedirectory ();6 }7 returnsddir.tostring ();8}
The root directory of SD card is obtained by GetPath method, String tmp = GetPath () + "/sample/xxx.shp"; , this way to get SHP files is not a problem (shp files placed in the SD card under the sample folder), but I use the phone when the test is not available, the original through the GetPath method to obtain a cell phone directory for/storage/emulated/ 0, this is not the root directory I want, how to do? A word of mouth, this may be related to the phone, perhaps your phone with GetPath can get the correct SD card directory. What if we can't get it?
1. String Strmapurl = "FILE:///STORAGE/SDCARD1/SAMPLE/BEIJING01.TPK"; This can get the TPK file and load it correctly
2. String geopathstring= "/storage/sdcard1/sample/road3.shp"; This can get the SHP file and load it correctly
3. String pathstring=new File (Environment.getexternalstoragedirectory (). GetParent ()). GetParent () + "/sdcard1/sample /road2.shp "; This can get the SHP file and load it correctly
The above three methods need to be based on the specific circumstances of the phone to try, I have so far not know what is the reason, the following is my phone directory structure
Well, it is superficial superficial phenomenon, the intrinsic substance I have not understood, welcome the great god to answer
About the path problems that are encountered when loading offline shp files, geodatabase files