intent对于电话和浏览器调用
来源:互联网 发布:尚武精神 知乎 编辑:程序博客网 时间:2024/05/19 10:16
1、创建xml文件及按钮
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/intentbtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="intent调用浏览器"
android:layout_marginTop="100dp"/>
<Button
android:id="@+id/intentbtncall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="intent调用电话"/>
</LinearLayout>
2、新创建一个Intent的java文件
ublic class Intent_s extends Activity {
//定义两个属性
private Button mbutton,callbutton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.intent);
//初始化属性
mbutton = (Button) findViewById(R.id.intentbtn);
callbutton=(Button)findViewById(R.id.intentbtncall);
//监听intent调用电话的按钮
callbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//标示地址
Uri uri = Uri.parse("tel:13881715535");
//新创建intent调用
Intent it = new Intent(Intent.ACTION_DIAL, uri);
//启动
startActivity(it);
}
});
//监听intent调用浏览器的监听
mbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//标示地址
Uri uri = Uri.parse("http://www.baidu.com");
//新创建intent
Intent intent = new Intent();
//调用intent
intent.setAction(Intent.ACTION_VIEW);
//向intent放入数据
intent.setData(uri);
//启动
startActivity(intent);
}
});
}
- intent对于电话和浏览器调用
- intent对于电话和浏览器调用
- intent对于电话和浏览器调用
- intent对于电话和浏览器调用
- intent对浏览器以及电话的具体调用
- intent对浏览器以及电话的具体调用
- android调用系统浏览器和拨打电话
- Intent隐式调用 滑动开关 隐式调用常用代码电话浏览器
- Android Intent 调用浏览器
- Android应用调用浏览器和电话的URI
- 调用系统电话/短信/浏览器
- Android利用Intent调用电话来打电话
- J2ME调用wap浏览器,调用电话功能。
- J2ME调用wap浏览器,调用电话功能。
- 调用Iphone 邮件 电话 sms 浏览器
- iphone调用系统电话、浏览器、地图…
- iOS 调用短信、电话、邮件、浏览器等
- 拨打电话、调用自带浏览器
- Servlet&JSP
- 《拖延心理学》序言
- Photoshop脚本 > 运动模糊滤镜的使用
- ViewPager多页面滑动效果
- 一步一步学zedboard之十七制作ramdisk镜像文件
- intent对于电话和浏览器调用
- css3,实现照片墙展示效果
- intent对于电话和浏览器调用
- Sql Server字符的处理(LastIndexOf用法),STUFF、CHARINDEX、REVERSE、LEN
- Introspector内省和反射的区别. 什么是Bean,对应的jdk概念有哪些,
- 连续签到的功能
- 《拖延心理学》序言
- intent对于电话和浏览器调用
- 赋予了条第一款今天第一款当天入园的