❶ 如何指定android中的瀏覽器跳轉界面
一、啟動android默認瀏覽器
在Android程序中我們可以通過發送隱式Intent來啟動系統默認的瀏覽器。如果手機本身安裝了多個瀏覽器而又沒有設置默認瀏覽器的話,系統將讓用戶選擇使用哪個瀏覽器來打開連接。關於Intent的更多內容請參考《常用Intent》
示例1
Intent intent =newIntent();
intent.setAction("android.intent.action.VIEW");
Uri content_url =Uri.parse("http://www.163.com");
intent.setData(content_url);
startActivity(intent);
這樣子,android就可以調用起手機默認的瀏覽器訪問。
二、啟動指定瀏覽器
在Android程序中我們可以通過發送顯式Intent來啟動指定的瀏覽器。
啟動Android原生瀏覽器
示例2
Intent intent =newIntent();
intent.setAction("android.intent.action.VIEW");
Uri content_url =Uri.parse("http://www.163.com");
intent.setData(content_url);
intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
startActivity(intent);
只要修改以intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
中相應的應用程序packagename 和要啟動的activity即可啟動其他瀏覽器來
uc瀏覽器":"com.uc.browser", "com.uc.browser.ActivityUpdate「
opera瀏覽器:"com.opera.mini.android", "com.opera.mini.android.Browser"
qq瀏覽器:"com.tencent.mtt", "com.tencent.mtt.MainActivity"
❷ 如何在Android中調用瀏覽器打開網頁
在Android中可以調用自帶的瀏覽器,或者指定一個瀏覽器來打開一個鏈接。只需要傳入一個uri,可以是鏈接地址。
啟動android默認瀏覽器
在Android程序中我們可以通過發送隱式Intent來啟動系統默認的瀏覽器。如果手機本身安裝了多個瀏覽器而又沒有設置默認瀏覽器的話,系統將讓用戶選擇使用哪個瀏覽器來打開連接。
用uc瀏覽器打開只需要把打開qq瀏覽器那行代碼注釋掉,然後打開uc瀏覽器那行代碼取消注視就行。