title: Load vector tiles from folder instead than from MBTiles file
body: <p>Is there a way to load several vector PBF files that are in a folder in a similar way than it's possible to do it now from an online source?</p>
  
  <p>My app deals with several MBTiles files, but I'd prefer to read a folder with PBFs in it instead. So I can load all the maps using only one layer and without having to remove the previous layer (bound to one MBTiles) and adding a new one.</p>
  
  <p>I can load PBFs from an online source by adding a layer bound to a <code>HTTPTileDataSource</code>:</p>
  
  <pre><code>HTTPTileDataSource(
                 0,
                  14,
                  "https://www.my-server.com/tiles/v3/{z}/{x}/{y}.pbf?key=MY_API_KEY)
  </code></pre>
  
  <p>I'd like to do the same, but with PBFs that are in the Android device. So there's offline support. Obviously, I can do this loading an MBTiles file, as I said above, but my use case has several files, and I'd like a transparent, smooth and simpler transition between maps.</p>
  
  <p>Could I write somehow the above URL in a way that it loads the PBFs from my device?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I forgot to mention that what I've tried so far didn't work. Basically I used the convention to access files on an Android device:</p>
  
  <pre><code>HTTPTileDataSource(
                  0,
                  14,
                  Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "/my-app/mbtiles/{z}/{x}/{y}.pbf")
  </code></pre>
  
  <p>This throws errors like:</p>
  
  <pre><code>2019-09-13 13:36:37.096 4432-4554/com.myapp.com.debug I/carto-mobile-sdk: HTTPTileDataSource::loadTile: Loading /storage/emulated/0/myapp/mbtiles/10/504/399.pbf
  2019-09-13 13:36:37.096 4432-4554/com.myapp.com.debug E/carto-mobile-sdk: HTTPTileDataSource::loadTile: Exception while loading tile 10/504/399: Invalid URL: /storage/emulated/0/myapp/mbtiles/10/504/399.pbf
  2019-09-13 13:36:37.096 4432-4554/com.myapp.com.debug I/carto-mobile-sdk: HTTPTileDataSource::loadTile: Loading /storage/emulated/0/myapp/mbtiles/10/503/399.pbf
  2019-09-13 13:36:37.097 4432-4554/com.myapp.com.debug E/carto-mobile-sdk: HTTPTileDataSource::loadTile: Exception while loading tile 10/503/399: Invalid URL: /storage/emulated/0/myapp/mbtiles/10/503/399.pbf
  </code></pre>
  
  <p>However, if I tried to read those files, by using the <code>File</code> class, and checking the <code>canRead()</code> method, they are readable. So they are there.</p>
  
  <p>Perhaps the issue is with the library that has been used to establish HTTP connections, that doesn't accept internal files?</p>
  
  <p>Using a similar approach, that prefixes the URLs with the "file://" protocol, throws a different error. The code is:</p>
  
  <pre><code>return new HTTPTileDataSource(
                  0,
                  14,
                  "file://" + Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "myapp/mbtiles/{z}/{x}/{y}.pbf");
  </code></pre>
  
  <p>And the error is:</p>
  
  <pre><code>2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534] JNI DETECTED ERROR IN APPLICATION: can't call void java.net.HttpURLConnection.setRequestMethod(java.lang.String) on instance of sun.net.www.protocol.file.FileURLConnection
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]     in call to CallVoidMethodV
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534] "Thread-51" prio=1 tid=37 Runnable
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   | group="main" sCount=0 dsCount=0 flags=0 obj=0x14500000 self=0x8a8ac800
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   | sysTid=5073 nice=19 cgrp=default sched=0/0 handle=0x8a782970
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   | state=R schedstat=( 61800737 288938844 285 ) utm=6 stm=0 core=2 HZ=100
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   | stack=0x8a688000-0x8a68a000 stackSize=1006KB
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   | held mutexes= "mutator lock"(shared held)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #00 pc 0047eae1  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt;&gt;&amp;, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+209)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #01 pc 0057c193  /system/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt;&gt;&amp;, bool, BacktraceMap*, bool) const+355)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #02 pc 00577693  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt;&gt;&amp;, bool, BacktraceMap*, bool) const+83)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #03 pc 00395256  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1254)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #04 pc 003956c1  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, char*)+113)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #05 pc 0014f207  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+71)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #06 pc 00152ff5  /system/lib/libart.so (art::ScopedCheck::CheckMethodAndSig(art::ScopedObjectAccess&amp;, _jobject*, _jclass*, _jmethodID*, art::Primitive::Type, art::InvokeType)+1941)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #07 pc 00151a3d  /system/lib/libart.so (art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, char*, art::Primitive::Type, art::InvokeType)+973)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #08 pc 0013df2b  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, char*)+75)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #09 pc 00222680  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #10 pc 002e4b7a  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #11 pc 00123455  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #12 pc 00122bfa  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #13 pc 00076084  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #14 pc 0025d7fc  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #15 pc 001206e1  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #16 pc 00110bb3  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #17 pc 000412c7  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #18 pc 00040e5f  /data/app/com.myapp.debug-bfKnles_CQatK-qZx2DX7A==/lib/x86/libcarto_mobile_sdk.so (???)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #19 pc 00071445  /system/lib/libc.so (__pthread_start(void*)+53)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #20 pc 000205db  /system/lib/libc.so (__start_thread+75)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   native: #21 pc 0001ec16  /system/lib/libc.so (__bionic_clone+70)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534]   (no managed stack frames)
  2019-09-13 13:41:33.782 4965-5073/com.myapp.debug A/zygote: java_vm_ext.cc:534] 
  </code></pre>