<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to read shape file from sd card on Android? in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607619#M4201</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;A _jive_internal="true" data-userid="242578" data-username="a741037987" href="https://community.esri.com/people/a741037987" style="color: #8ca9cd; background-color: #ffffff; border: 0px; font-weight: 200; font-size: 1.286rem;"&gt;白 李&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;It was my fault because I forgot to explicitly request the READ_EXTERNAL_STORAGE permission in the application using&amp;nbsp;ActivityCompat.requestPermissions() since the targetSdk was 23 (Marshmallow) &amp;nbsp;it wasn't enough to declare the permission in AndroidManifest.xml. In the end I just set 'targetSdkVersion &lt;SPAN style="color: #0000ff;"&gt;22' &lt;/SPAN&gt;in build.gradle and everything worked fine.&lt;/P&gt;&lt;P&gt;Sorry for the trouble and thank you for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Nov 2016 13:40:01 GMT</pubDate>
    <dc:creator>CrisPlutis</dc:creator>
    <dc:date>2016-11-25T13:40:01Z</dc:date>
    <item>
      <title>How to read shape file from sd card on Android?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607617#M4199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Hello,

I was trying to display some geometry from a shapefile in Android and I ran into this exception when trying to create a 
ShapeFileFeatureTable using a path on the sd card:

&amp;nbsp;java.lang.RuntimeException: Shape file not found: /storage/emulated/0/stations.shp
 at com.esri.core.geodatabase.Geodatabase.nativeOpenShapefile(Native Method)
 at com.esri.core.geodatabase.Geodatabase.a(SourceFile:126)
 at com.esri.core.geodatabase.ShapefileFeatureTable.&amp;lt;init&amp;gt;(SourceFile:79)

I've tried with different paths and with and without the first '/' and haven't managed to fix this error. The file exists on the 
sd card and can be read by the app as Geodatabase.a() checks if the file exists and throws a FileNotFoundException otherwise.

This is the source code I'm using (the full project and shape file are also attached):

File esd = Environment.&lt;SPAN&gt;getExternalStorageDirectory&lt;/SPAN&gt;();
&lt;SPAN style="color: #808080;"&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String path = esd.getPath() + "/stations.shp";
&lt;/SPAN&gt;String path = &lt;SPAN style="color: #067ed5; font-weight: bold;"&gt;"/storage/emulated/0/stations.shp"&lt;/SPAN&gt;;
Log.&lt;SPAN&gt;w&lt;/SPAN&gt;(&lt;SPAN style="color: #067ed5; font-weight: bold;"&gt;"shp path"&lt;/SPAN&gt;, &lt;SPAN style="color: #067ed5; font-weight: bold;"&gt;"path " &lt;/SPAN&gt;+ path);
ShapefileFeatureTable shpFile = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;null&lt;/SPAN&gt;;
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{
&amp;nbsp;&amp;nbsp; shpFile = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;ShapefileFeatureTable(path);
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(shpFile != &lt;SPAN style="color: #000080; font-weight: bold;"&gt;null&lt;/SPAN&gt;) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Envelope env = shpFile.getExtent();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(env != &lt;SPAN style="color: #000080; font-weight: bold;"&gt;null&lt;/SPAN&gt;) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Log.&lt;SPAN&gt;w&lt;/SPAN&gt;(&lt;SPAN style="color: #067ed5; font-weight: bold;"&gt;"read shape"&lt;/SPAN&gt;, env.getWidth() + &lt;SPAN style="color: #067ed5; font-weight: bold;"&gt;"x" &lt;/SPAN&gt;+ env.getHeight());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
} &lt;SPAN style="color: #000080; font-weight: bold;"&gt;catch &lt;/SPAN&gt;(FileNotFoundException e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
}

&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Can anyone please tell me if i'm doing something wrong or if the shape file is not valid. Also is there any other way to display 
Geometry objects from shape files? Any help will be appreciated.

Thank you,
Chris&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:01:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607617#M4199</guid>
      <dc:creator>CrisPlutis</dc:creator>
      <dc:date>2021-12-12T02:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to read shape file from sd card on Android?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607618#M4200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE style="color: #000000; background-color: #ffffff; border: 0px; font-size: 9pt;"&gt;String path = &lt;SPAN style="color: #067ed5; border: 0px; font-weight: bold; font-size: 13.3333339691162px;"&gt;"/mnt/sdcard/stations.shp"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2016 03:05:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607618#M4200</guid>
      <dc:creator>白李</dc:creator>
      <dc:date>2016-11-24T03:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to read shape file from sd card on Android?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607619#M4201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;A _jive_internal="true" data-userid="242578" data-username="a741037987" href="https://community.esri.com/people/a741037987" style="color: #8ca9cd; background-color: #ffffff; border: 0px; font-weight: 200; font-size: 1.286rem;"&gt;白 李&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;It was my fault because I forgot to explicitly request the READ_EXTERNAL_STORAGE permission in the application using&amp;nbsp;ActivityCompat.requestPermissions() since the targetSdk was 23 (Marshmallow) &amp;nbsp;it wasn't enough to declare the permission in AndroidManifest.xml. In the end I just set 'targetSdkVersion &lt;SPAN style="color: #0000ff;"&gt;22' &lt;/SPAN&gt;in build.gradle and everything worked fine.&lt;/P&gt;&lt;P&gt;Sorry for the trouble and thank you for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 13:40:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-read-shape-file-from-sd-card-on-android/m-p/607619#M4201</guid>
      <dc:creator>CrisPlutis</dc:creator>
      <dc:date>2016-11-25T13:40:01Z</dc:date>
    </item>
  </channel>
</rss>

