top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is fileUri in android and how to use it?

+3 votes
298 views

Recently I am trying to make an app and from google search I have found a code which uses fileUri for completion of my required task.
My question is - what is fileUri in android and how to use it, any sample code would be helpful?

posted Mar 6, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

There is a class named Uri which extends Object class and implements Parcelable Comparable and method of this class,

 public static Uri fromFile (File file)

Creates a Uri from a file. The URI has the form "file://". Encodes path characters with the exception of '/'.Example: "file:///tmp/android.txt". In android to create Uri of a file see this code segment -

 // Create a Uri for files on external storage
         File externalFile = new File(Environment.getExternalStorageDirectory(), "queryhomeTutorial.pdf");
         Uri external = Uri.fromFile(externalFile);
answer Mar 8, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

Please give a work flow, java code is not necessary.

0 votes

I am working on create some window that is create in a service and got some UI problem recently. The difficult thing is that I cant use the Tracer for OpenGL ES tool because I cannot specify an Activity, so What should I do to trace the frame in my window?

...