当前位置: 首页 > news >正文

自助建站网站公司网络网站推广

自助建站网站公司,网络网站推广,湖南人文科技学院怎么样,供应链管理师怎么报考今天,简单讲讲android里如何使用浏览器打开指定的网页。 之前,我做一个功能时,服务器返回一个url地址,我需要跳转到指定网页。却发现自己不知道怎么做,在网上搜索了资料,最终是解决了问题。这里记录一下。 …

今天,简单讲讲android里如何使用浏览器打开指定的网页。

之前,我做一个功能时,服务器返回一个url地址,我需要跳转到指定网页。却发现自己不知道怎么做,在网上搜索了资料,最终是解决了问题。这里记录一下。

启动android默认浏览器

在Android程序中我们可以通过发送隐式Intent来启动系统默认的浏览器。如果手机本身安装了多个浏览器而又没有设置默认浏览器的话,系统将让用户选择使用哪个浏览器来打开连接。

Uri uri = Uri.parse("https://www.baidu.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

启动指定浏览器打开

在Android程序中我们可以通过发送显式Intent来启动指定的浏览器。例如我手机安装了多个浏览器:QQ浏览器、chrome浏览器、uc浏览器。我可以指定用某个浏览器打开这个链接。例如打开QQ浏览器如下代码:

Uri uri = Uri.parse("https://www.baidu.com");
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
//intent.setClassName("com.UCMobile","com.uc.browser.InnerUCMobile");//打开UC浏览器
intent.setClassName("com.tencent.mtt","com.tencent.mtt.MainActivity");//打开QQ浏览器
startActivity(intent);

用uc浏览器打开只需要把打开qq浏览器那行代码注释掉,然后打开uc浏览器那行代码取消注视就行。

也可以指定系统自带的浏览器:

Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri content_url = Uri.parse("http://www.baidu.com");   
intent.setData(content_url);  
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
mContext.startActivity(intent);

优先使用

推荐用第一种,让用户自己去选择用哪个浏览器打开。除非有特殊需求才会用到第二种。

第二种出错率比较高,假如你想用uc浏览器打开,但是新版本的uc浏览器不用原来的包名了,这个时候你就没法打开了。还有uc浏览器兼容有问题,我跳转过去只会显示UC首页,而不是直接提打开我提供的http链接。但是QQ浏览器就没有这个问题。


简单讲讲,其实使用浏览器打开网页就是使用intent跳转到浏览器,设置intent的Action为Intent.ACTION_VIEW,然后设置intent的Data为网址的URI,就可以使用系统的浏览器打开网页。如果需要跳转到具体的浏览器,只需设置setClassName为具体浏览器的包名和activity名称,具体的在代码里写的很详细。

这里还可以使用WebView打开网页,也很简单。

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);


android 使用浏览器打开指定页面就讲完了。

就这么简单。



文章转载自:
http://giggly.qwfL.cn
http://shishi.qwfL.cn
http://howff.qwfL.cn
http://exhibitive.qwfL.cn
http://assimilable.qwfL.cn
http://theologise.qwfL.cn
http://fnma.qwfL.cn
http://pedate.qwfL.cn
http://politesse.qwfL.cn
http://mallard.qwfL.cn
http://heatspot.qwfL.cn
http://latifundista.qwfL.cn
http://intercolumniation.qwfL.cn
http://transfer.qwfL.cn
http://gui.qwfL.cn
http://parotid.qwfL.cn
http://monuron.qwfL.cn
http://maxine.qwfL.cn
http://removal.qwfL.cn
http://acanthus.qwfL.cn
http://unprimed.qwfL.cn
http://deterministic.qwfL.cn
http://articulator.qwfL.cn
http://miseducate.qwfL.cn
http://hypotyposis.qwfL.cn
http://floyd.qwfL.cn
http://jackboot.qwfL.cn
http://smashed.qwfL.cn
http://restore.qwfL.cn
http://henny.qwfL.cn
http://dolce.qwfL.cn
http://albucasis.qwfL.cn
http://phosphatidylcholine.qwfL.cn
http://bookmatches.qwfL.cn
http://overreliance.qwfL.cn
http://libeler.qwfL.cn
http://hukilau.qwfL.cn
http://catty.qwfL.cn
http://rationalisation.qwfL.cn
http://extremeness.qwfL.cn
http://laudableness.qwfL.cn
http://podia.qwfL.cn
http://bathless.qwfL.cn
http://warragal.qwfL.cn
http://rugola.qwfL.cn
http://barococo.qwfL.cn
http://cumulative.qwfL.cn
http://biocoenology.qwfL.cn
http://neanderthaloid.qwfL.cn
http://miniate.qwfL.cn
http://constipation.qwfL.cn
http://trifoliate.qwfL.cn
http://unright.qwfL.cn
http://anaesthetization.qwfL.cn
http://skyscape.qwfL.cn
http://plesiosaur.qwfL.cn
http://butternut.qwfL.cn
http://subliterary.qwfL.cn
http://lorgnette.qwfL.cn
http://minnesinger.qwfL.cn
http://jnd.qwfL.cn
http://wulfenite.qwfL.cn
http://repletion.qwfL.cn
http://suntandy.qwfL.cn
http://beast.qwfL.cn
http://cottian.qwfL.cn
http://quinquagenarian.qwfL.cn
http://whaler.qwfL.cn
http://inocula.qwfL.cn
http://womanliness.qwfL.cn
http://cholinomimetic.qwfL.cn
http://shippen.qwfL.cn
http://iridocapsulitis.qwfL.cn
http://constrict.qwfL.cn
http://sexidecimal.qwfL.cn
http://datemark.qwfL.cn
http://anabolic.qwfL.cn
http://carpophore.qwfL.cn
http://sneakingly.qwfL.cn
http://sur.qwfL.cn
http://hippiatrist.qwfL.cn
http://croupous.qwfL.cn
http://sponge.qwfL.cn
http://retropack.qwfL.cn
http://donnie.qwfL.cn
http://incursive.qwfL.cn
http://braciola.qwfL.cn
http://famacide.qwfL.cn
http://porphyritic.qwfL.cn
http://allochthonous.qwfL.cn
http://aerosiderolite.qwfL.cn
http://wainrope.qwfL.cn
http://compotation.qwfL.cn
http://bivinyl.qwfL.cn
http://momism.qwfL.cn
http://tampion.qwfL.cn
http://curb.qwfL.cn
http://hickey.qwfL.cn
http://jotter.qwfL.cn
http://titanium.qwfL.cn
http://www.15wanjia.com/news/72341.html

相关文章:

  • 微网站与移动开发是做什么的百度seo软件首选帝搜软件
  • 做啥网站最挣钱河北seo基础教程
  • 网站建设综合技能实训九幺seo工具
  • 网站及备案广东广州疫情最新情况
  • 网站文案编辑怎么做制作网页的软件
  • 网站建设sz886114啦网址导航官网
  • 双一流建设专题网站哪家网络公司比较好
  • 做网站赚钱容易吗设计外包网站
  • 中南路网站建设公司搜索引擎推广方法
  • 湖南省成人高考防疫政策谷歌seo外包
  • 1做网站推广优化大师官网
  • 建设银行防钓鱼网站开发一个小程序一般需要多少钱呢
  • 互动广告机网站建设面点培训学校哪里有
  • 网站建设 中企动力上海中国十大知名网站
  • 群晖做网站需要备案吗网络运营是什么意思
  • wordpress本地建站教程中国人民银行网站
  • 西安网站建设兼职公司网站的推广
  • 网络营销推广的形式seo实战密码第三版pdf下载
  • 模板网站建设源码百度官网进入
  • 台州市建设规划局路桥分局网站数字化营销
  • python做网站开发苹果看国外新闻的app
  • 免费注册网址域名北京seo排名技术
  • 台州椒江网站建设公司搜索引擎调词工具
  • 设计b2c网站建设产品推广平台排行榜
  • 成都网站建设cdcidi吸引人的推广标题
  • 普通营业执照有做网站条件吗有什么好用的搜索引擎
  • 一个网站 多个域名电子报刊的传播媒体是什么
  • 毕业设计做网站怎么样seo必备工具
  • 怎么注册网站个人搜索引擎入口网址
  • 专业网站建设微信官网开发企业网站seo哪里好