First question here is why it displays a file named “servo.dat” as numbers (in this case it shows “5889”)?
Because it is not a file. It is a piece of content, and you are attempting to treat the path portion of a
Uri as a filesystem path, which is is not.
If you want a display name for the content:
DocumentFile.fromSingleUri(), passing in your
Uri, to create a
Basically the path provided here is incorrect
That is because you are trying to treat the path portion of a
Uri as a filesystem path, which it is not.
To get an
openInputStream() on a
ContentResolver, passing in your
Uri. See the documentation. So, for example, from a method in an
Activity, you would use
InputStream inputStream = getContentResolver().openInputStream(uri);.
I’m getting confused since I’m new to both Android app development and Android itself
You may wish to consider reading a book on Android app development or taking a course in Android app development.
CLICK HERE to find out more related problems solutions.