當前位置:首頁 » 安卓系統 » android打開瀏覽器

android打開瀏覽器

發布時間: 2023-05-10 20:20:29

① Android從瀏覽器中打開本地應用

開發中遇到的一些問題特此記錄:

1、應用場景一  在瀏覽器中要求直接打開到安裝的應用中  

需要在該應用的啟動Activity 清單文件中進行配置

<Intent-filter>

   <action  android:name="android.intent.action.VIEW"/>

   <category android:name="android.intent.category.DEFAULT"/>

   <category android:name="android.intent.category.BROWSABLE"/>

   <data

       android:host="com..test"

       android:scheme="text"/>

</Intent-filter>

此處對應的data數據 跟伺服器人員進行交互的時候為:text://com..test

2、中前應用場景二 在瀏覽器中進行打開 並且要求打開指定的具體的頁面

首先得在清單文件中進行上面一樣的配置  接著和從其他跳轉的activity中獲取的一樣 ,通過intent來進行數據的獲取

if(intent !=null) {

     Uri uri = intent.getData();

      if(uri !=null) {

           String host = uri.getHost();

     帆扒       LogUtil.d(TAG,host);

             String data = uri.getQueryParameter("code");

           try{

                  jumpData= URLDecoder.decode(data,"UTF-8");

                  LogUtil.d(TAG,jumpData);

            }catch(UnsupportedEncodingException e) {

                  e.printStackTrace();

         賣轎清   }

      }

}

這樣獲取到的數據就是需要的數據 所要跳轉的具體信息具體跳轉類型都會獲取到,然後在跟以前一樣進行跳轉就可以了。

② 如何在Android中調用瀏覽器打開網頁

android打開系統默認的軟體,通常使用的是inent意圖這個類,如下打開瀏覽器: Intent
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// get the view web intent
Intent intent = this.getViewWebIntent();
this.(intent);
// set the className to use the specific browser to open the webpage.
intent.setClassName("com.tencent.mtt", "com.tencent.mtt.MainActivity");
startActivity(intent);
}

/*
*get the desired view web intent
*/
private Intent getViewWebIntent() {
Intent viewWebIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("http://www.2cto.com");
viewWebIntent.setData(uri);
return viewWebIntent;
}
裡面可以填上任意的url,也可以利用inent發送信息、撥打電話,記日歷

③ Android程序中怎麼啟動瀏覽器

一、啟動android默認瀏覽器

在Android程序中我們可以通過發送隱式Intent來啟動系統默認的瀏覽器巧猛。如果手機本身安裝了多個瀏覽器而又沒有設置默認瀏覽器的話,系統將讓用戶選擇使用哪個瀏覽器來打開連接。關於Intent的更多內容請參考《孝則橋常用Intent》

示例1

Intent intent = new Intent();
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 = new Intent();
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開發:調起手機瀏覽器

一、調起手機御拆攔默認瀏覽器
這里以調起 網路網頁 為例。

二、指定相應的瀏覽器訪問

調御圓起瀏覽器前需要判斷該App是否已經安裝在手機上,鎮胡否則會使程序崩潰哦~可參考 Android開發:檢測手機上是否安裝該App

三、如果你從事Flutter開發,你應該還需要 iOS開發:調起Safari瀏覽器打開Url(對中文等特殊字元進行處理) 的知識

⑤ 如何在Android中調用瀏覽器打開網頁

在安卓代碼中我們有時需要調用瀏覽器來打開相應的網頁,此時可以有以下幾種實現方式:
一:
調用默認瀏覽器

Intent intent = new Intent(); //Intent
intent = new Intent(Intent.ACTION_VIEW,uri);
intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("此處填鏈接"); intent.setData(content_url); startActivity(intent);

其他瀏覽器

Intent intent = new Intent(); //Intent
intent = new Intent(Intent.ACTION_VIEW,uri); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("此處填鏈接"); intent.setData(content_url); intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
startActivity(intent);
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"
二:

1、自定義一個簡單的WebView瀏覽器,設置下面屬性:

mWebView = (ProgressWebView) findViewById(R.id.baseweb_webview); mWebView.getSettings().setjavaScriptEnabled(true); mWebView.setWebViewClient(new WebViewClient());

2、指定需要打開的額網頁,在自定義的WebViewActivity中打開,如:

WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.loadUrl("http://www.hao123.com");

3、還可以查看相關的自定義WebView簡單瀏覽器的Demo,《WebView控制項實現的簡單瀏覽器效果》,以及對應的TeachCourse介紹怎麼使用

⑥ 如何在Android中調用瀏覽器打開網頁

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

webView = (WebView) findViewById(R.id.webview);

// 設置支持javascript

webView.getSettings().setJavaScriptEnabled(true);

// 啟動緩存

webView.getSettings().setAppCacheEnabled(true);

// 設置緩存模式

webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);

// 載入網頁

webView.loadUrl("
<a href="http://..com/question/1797038222865379867.html?entry=qb_ihome_tag" target="_blank">http://..com/question/1797038222865379867.html?entry=qb_ihome_tag</a>
");

// 在當前的瀏覽器中響應

webView.setWebViewClient(new WebViewClient());//
需要添加網路<a href="https://www..com/s?wd=%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90&tn=44039180_cpr&fenlei=-hPEUiqkIyN1IA-EUBtznWmvrHn3n10zn1csPjcvP1f3" target="_blank" class="-highlight">訪問許可權</a>

⑦ 安卓打開瀏覽器提示輸入指令解鎖功能

關閉方法如下:
1、在手機桌面上找到瀏覽器並打開。
2、在打開的瀏覽器收藏夾頁面。我們點擊手機左下角的編輯並枯按鈕。
3、在彈出的的諸多菜單中,選擇仿數點擊的絕大洞是:設置。
4、找到高級這一項,點擊進入。
5、把裡面的幾項默認開啟的服務,全部關掉即可。

熱點內容
隨機啟動腳本 發布:2025-07-05 16:10:30 瀏覽:524
微博資料庫設計 發布:2025-07-05 15:30:55 瀏覽:24
linux485 發布:2025-07-05 14:38:28 瀏覽:304
php用的軟體 發布:2025-07-05 14:06:22 瀏覽:753
沒有許可權訪問計算機 發布:2025-07-05 13:29:11 瀏覽:430
javaweb開發教程視頻教程 發布:2025-07-05 13:24:41 瀏覽:695
康師傅控流腳本破解 發布:2025-07-05 13:17:27 瀏覽:239
java的開發流程 發布:2025-07-05 12:45:11 瀏覽:684
怎麼看內存卡配置 發布:2025-07-05 12:29:19 瀏覽:282
訪問學者英文個人簡歷 發布:2025-07-05 12:29:17 瀏覽:833