문제

I have an app that use its own file format.

I want that when the user click on a file with extension .myAppFormatfrom any file manager

I have already read this question to understand how to register a new file format.

My problem: How to get the full file path on opening to allow my method to load the file?

My method is something like:

public void loadFile(String path){
FileInputStream savedSerializable = new FileInputStream(path);
...
}
도움이 되었습니까?

해결책

If your activity is newly created, in onCreate() you can call getIntent().getData() to get the Uri of the file that triggered your activity.

If your activity instance already existed, call getData() on the Intent that is delivered to your onNewIntent() method.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top