In my application I would like to use a gpx file downloaded from the server.
I use GPXParser from https://github.com/ticofab/android-gpx-parser .
When I was trying to parse gpx file, I got warring "java.io.FileNotFoundException: No content provider"
Gpx parsedGpx = null;
GPXParser parser = new GPXParser();
InputStream inputStream = getContentResolver().openInputStream(Uri.parse(stringUrl));
parsedGpx = parser.parse(inputStream);
How can I solve my problem?
CodePudding user response:
getContentResolver is to get data from a ContentResolver not from any random Url, it is for getting data from other processes and usually takes the string form of content://....
You need to download the gpx first with something like HttpURLConnection and it's getInputStream()
method to get an inputStream
to use with the parser.