我已經使用此代碼。如何爲視頻和html文件設置MIME類型?
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(uri, "text/html");
StartActivity(i);
but samsung device show the video player onaction using.
i want to show only install browser.
我已經使用此代碼。如何爲視頻和html文件設置MIME類型?
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(uri, "text/html");
StartActivity(i);
but samsung device show the video player onaction using.
i want to show only install browser.
編輯:(刪除舊的答案)
當你火ACTION_VIEW的意圖,萬一有註冊使用其清單文件這個動作的其他應用程序,假定這些被上至少運行一次你設備,他們將出現在選擇器中。有許多應用程序註冊了一些Intent操作,但沒有正確過濾數據類型,並且忽略了這些參數。
我的東西打開默認瀏覽器,但不顯示所有安裝瀏覽器。 –
我的問題通過在三星設備中使用createChooser()解決。
用於瀏覽器。
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
this.startActivity(Intent.createChooser(intent, "Chose browser"));
視頻。
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setType("video/mp4");
this.startActivity(Intent.createChooser(intent, "Chose browser"));
你能告訴我們你試圖打開一個鏈接的個例? – Gomino