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