Check if intent uri is available

人盡茶涼 提交于 2019-11-28 21:30:56

You can use resolveActivity() to detect whether there is any Activity in the system capable of handling your intent. Of course you need to construct the intent that mimics the "uri" click. That might be done using Intent.setData() function, though I didn't test/verify that myself.

Following worked for me:

    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    Uri uri = Uri.parse("imdb:///title/tt1457767/");
    intent.setData(uri);
    this.getActivity().startActivity(intent);

You can replace String in Uri.parse("");with any of followings:

            imdb:///name/<nameID>
            imdb:///find?q=<search_query>
            imdb:///title/<titleID>
            imdb:///boxoffice
            imdb:///name/<nameID>
            imdb:///find?q=toystory
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!