質問

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