top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to convert a Uri to file in android studio?

+2 votes
597 views
How to convert a Uri to file in android studio?
posted Mar 6, 2016 by anonymous

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

1 Answer

+1 vote

Use File class and getPath() method to get file from Uri.

File file=new File(Uri.getPath());
answer Mar 6, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

I'm using uri to read the contacts that are stored in mobile. Now I want display those names in autocomplete. Please explain me how to add uri in AutoCompleteTextView?

+2 votes

I am using drop down menu (spinner) and I want know how to get value from drop down menu to a variable if user selects one?
Example : select city=Varanasi,Delhi,Chennai,Erode etc. and if user selects Chennai then store it to a java variable.

   String selectedCity;
   //after selecting from drop down menu
   selectedCity="Chennai";
+2 votes

I have added a floating action button in my layout but using backgroundtilt, it doesn't change the color of background.

Here my code segment

   <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/AddNewButton"
        android:background="@drawable/add"
        android:layout_margin="15dp"
        app:rippleColor="@android:color/white"
        app:fabSize="normal"
        android:clickable="true"
        app:layout_anchor="@+id/HeaderSection"
        app:layout_anchorGravity="bottom|right|end"/>
...