从谷歌驱动器选择文件后如何获取文件的最后修改日期

时间:2021-07-05 12:21:27

标签: metadata

------- onActivityResult ------

ClipData clipData = data.getClipData();

uri uri = data.getData(); String filePath =ProgTools.getPath2(getContext(),uri);

File file = new File(filePath);

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String lastModDate=sdf.format(file.lastModified());

int fileDate2=ProgTools.convDsToDi(lastModDate);


----------- getPath2() -------

私有静态布尔值 isGoogleDriveUri(Uri uri) { 返回 "com.google.android.apps.docs.storage".equals(uri.getAuthority()) || "com.google.android.apps.docs.storage.legacy".equals(uri.getAuthority()); }

if(isGoogleDriveUri(uri)){ //在这里获取谷歌驱动器路径

              return String.valueOf(uri);

            }

------- 结果是 -------------

这是谷歌驱动器 uri "content://com.google.android.apps.docs.storage/document/acc%3D3%3Bdoc%3Dencoded%3DGp3qNtSd17JyIvWWjN4kiMe66gjReS6bFjH9yJoRGAp7CAxPF3tSqyiUVZ"%3Dgp3qNtSd17JyIvWWjN4kiMe66gjReS6bFjH9yJoRGAp7CAxPF3tSqyiUVZZnmX%3D3%3Bdoc%3Dencoded%3DGp3qNtSd17JyIvWWjN4kiMe66gj

01\01\1970

0 个答案:

没有答案