开发者

Associate file extension to Android app and handle the file

开发者 https://www.devze.com 2023-04-09 01:38 出处:网络
In my android app I want to associate my app with *.bin extension. Whenever a user click on a *.bin file, I want my app to be started and make a conversion. This link shows associating process, but wh

In my android app I want to associate my app with *.bin extension. Whenever a user click on a *.bin file, I want my app to be started and make a conversion. This link shows associating process, but when the app is onCreate, how can I ge开发者_StackOverflow中文版t the file, its path, etc?

I couldn't find how to do that. Thanks in advance.


when the app is onCreate, how can I get the file, its path, etc?

Call getIntent().getData() in your Activity to retrieve the Uri that represents the file or URL that you are to open.


Your path will be the URI passed from intent:

Intent intent = getIntent();
String path = intent.getDataString();
0

精彩评论

暂无评论...
验证码 换一张
取 消