调用系统自带浏览器的方法
来源:互联网 发布:sql语句between包含 编辑:程序博客网 时间:2024/04/29 21:32
调用系统自带的浏览器打开网页有两种方法。
第一种方法:
Intent intent = new Intent(Intent.ACTION_VIEW);intent.setData(Uri.parse("http://www.baidu.com"));startActivity(intent);
第二种方法:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));startActivity(intent);
一个完整的例子如下:
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.webviewdemo1.MainActivity" > <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Open Website" /></RelativeLayout>
MainActivity.java
public class MainActivity extends Activity {private Button button;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);button = (Button)findViewById(R.id.button);button.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {//Intent intent = new Intent(Intent.ACTION_VIEW);//intent.setData(Uri.parse("http://www.baidu.com"));//startActivity(intent);Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));startActivity(intent);}});}}
0 0
- 调用系统自带浏览器的方法
- 调用Android系统自带的图片浏览器
- 如何调用android系统自带的一些方法
- Android系统自带图标调用方法
- Android指定调用系统自带浏览器打开链接
- android webview 运行时不调用系统自带浏览器
- android 调用系统自带的控件
- android系统自带的程序调用
- iOS 调用系统自带的通讯录
- 调用系统自带的通信录
- 启动系统自带浏览器
- view自带方法的调用时间
- cell 的自带的系统方法
- 怎么调用android 自带的图片浏览器
- 安卓调用手机自带的浏览器
- 需要重新系统自带的方法
- iOS 系统自带的侧滑返回触发时的方法调用情况
- 如何在WebView中点击链接,使用自己的activity打开,不调用系统自带的浏览器
- 人一生要做的一百件事
- ActiveAndroid的建表跟踪
- 协议
- 代码整洁之道 函数,注释
- CPU占用率问题
- 调用系统自带浏览器的方法
- MUI-CheckBox的基本介绍
- target action
- SharePoint 2013 IT Professional--巧用Navigation Audience
- android布局的问题----有些布局始终置底
- iOS 2D绘图详解(Quartz 2D)之路径(stroke,fill,clip,subpath,blend)
- oleload导excel数据
- ngix使用
- 关于button的用法