Not getting the actual filepath from getpath() and unable to load .gItf file from local on by using AR Core[Android Begginer]

隐身守侯 提交于 2019-12-13 04:17:33

问题


I am working on an AR app which enables the user to upload the .gItf file they downloaded in their phone local storage and place it on AR with Android AR Core.

However, i faced some issues....

1) I can't get the file path about the .gItf file

Isit because of the permission issue?

How I let the user upload file

 @Override
 public void onClick(View v) {

       Intent intent = new Intent();
       intent.setType("*/*");
       intent.setAction(Intent.ACTION_GET_CONTENT);

       //To start a activity that will return result
       startActivityForResult(intent,PICK_FILES);
       //startActivityForResult(Intent.createChooser(intent,"Select your .gITF"),PICK_FILES);
}

How I try to get the path name

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        if(requestCode==PICK_FILES && resultCode==RESULT_OK && data != null){

            path = data.getData().getPath();

            System.out.println(path);

        }else{
            Toast.makeText(MainActivity.this,"Please select a valid file",Toast.LENGTH_LONG);
        }
}

My manifest file

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

What the printIn returnscontent://com.google.android.apps.docs.storage/document/acc=2;doc=encoded=Wsi4zjmWYALAW/AO7bh0PsFGouCMhVw4QQj3XtHR36/iUIjd instead of something with file//xxxx.gItf

Any solutions? Really need help as I browse alot of online resources but it did not work....

来源:https://stackoverflow.com/questions/59212219/not-getting-the-actual-filepath-from-getpath-and-unable-to-load-gitf-file-fro

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!