欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android調(diào)用默認(rèn)瀏覽器打開指定Url的方法實(shí)例

 更新時(shí)間:2013年09月11日 14:59:14   作者:  
業(yè)務(wù)員有需求要將一個(gè)wap站在手機(jī)上以App的形式打開,還不要嵌套WebView,只能以瀏覽器打開.查了點(diǎn)資料,就有了下面這代碼

復(fù)制代碼 代碼如下:

package com.gzz.whyinzi;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {
    private static final String TAG = "ActivityDemo";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       
        Intent intent = new Intent();       
        intent.setAction("android.intent.action.VIEW");   
        Uri content_url = Uri.parse(http://www.dbjr.com.cn);  
        intent.setData(content_url); 
        startActivity(intent);

       
    }

        @Override 
        protected void onResume() { 
            super.onResume();
            Intent intent = new Intent();       
            intent.setAction("android.intent.action.VIEW");   
            Uri content_url = Uri.parse("http://play.jb51.net");  
            intent.setData(content_url); 
            startActivity(intent);
            Log.e(TAG, "start onResume~~~"); 
        } 

        @Override 
        protected void onStop() { 
            super.onStop(); 
            this.finish();
            Log.e(TAG, "start onStop~~~"); 
        } 
}


onResume()在沒(méi)有默認(rèn)瀏覽器的時(shí)候就起作用了,當(dāng)沒(méi)有默認(rèn)瀏覽器的時(shí)候會(huì)彈出提示以哪個(gè)瀏覽器打開,如果點(diǎn)擊取消就會(huì)出現(xiàn)黑色背景,為防止出現(xiàn)黑色背景,onsume()重新調(diào)用打開瀏覽器.

onStop()在選擇瀏覽器后結(jié)束進(jìn)程.

相關(guān)文章

最新評(píng)論