android - How to get file name and real path of Google drive document? -


i using following code file name , path of files in file manager. not return path google drive files. idea how obtain actual path?

my code -

public string getfilepath() {     if (uri.getscheme().equalsignorecase("file")) {         return uri.getlastpathsegment();     }      cursorloader.seturi(uri);     cursorloader.setprojection(projections);     cursor cursor = cursorloader.loadinbackground();     int column_index = cursor.getcolumnindexorthrow(mediastore.files.filecolumns.data);     cursor.movetofirst();     string realpath = cursor.getstring(column_index);     cursor.close();      if (realpath == null || realpath.isempty()) {         return null;     }  return null; } 

you have use uri. through uri can getcontentresolver.query(theurithatyouhave, null, null, null, null). have cursor, can check column names etc.

for google drive there column name _display_name. give file name.

now want access file? can open inputstream uri via getcontentresolver().openinputstream(theurithatyouhave).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -