Intent的花样用法
来源:互联网 发布:java微服务架构有哪些 编辑:程序博客网 时间:2024/06/10 06:50
Intent能够做很多事,我这次说一下它调用手机系统方面的能力
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } //拨打电话 public void onClick1(View v){ Intent intent=new Intent(Intent.ACTION_CALL,Uri.parse("tel:10086")); startActivity(intent); } //调用拨号程序 public void onClick2(View v){ Intent intent=new Intent("com.android.phone.action.TOUCH_DIALER"); startActivity(intent); } //调用联系人程序 public void onClick3(View v){ Intent intent=new Intent("com.android.contacts.action.LIST_CONTACTS"); startActivity(intent); } //调用系统设置界面 public void onClick4(View v){ Intent intent=new Intent("android.settings.SETTINGS"); startActivity(intent); } //显示WIFI设置界面 public void onClick5(View v){ Intent intent=new Intent("android.settings.WIFI_SETTINGS"); startActivity(intent); }}<?xml version="1.0" encoding="utf-8"?><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="android.com.myapplication.MainActivity"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button1" android:onClick="onClick1" android:id="@+id/button1"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button2" android:layout_below="@+id/button1" android:onClick="onClick2" android:id="@+id/button2"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" android:onClick="onClick3" android:layout_below="@+id/button2" android:id="@+id/button3"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" android:layout_below="@+id/button3" android:onClick="onClick4" android:id="@+id/button4"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button5" android:onClick="onClick5" android:layout_below="@+id/button4"/></RelativeLayout> <uses-permission android:name="android.permission.CALL_PHONE" />
再见
阅读全文
0 0
- Intent的花样用法
- Intent的常见用法
- Intent的常见用法
- Intent的用法总结
- Activitu Intent的用法
- Intent的若干用法
- Intent 的用法
- Intent 的用法
- Intent的实例用法
- Intent的用法
- Intent的用法
- Intent的用法
- Intent的常见用法
- Intent的用法
- Intent的常见用法
- Intent的用法
- Intent的常见用法
- Android Intent的用法
- 一个shell脚本写的测试框架
- c/c++整理--类String的构造函数、析构函数和赋值函数
- bzoj1345: [Baltic2007]序列问题Sequence
- 浅谈Three.js源码-render之WebGLLights.js
- 身份证云识别sdk基于服务器的部署
- Intent的花样用法
- sql注入
- 基本排序算法之冒泡排序
- pinyin4j使用说明
- 使用java如何实现下载
- 【机器学习杂货铺】——无监督和有监督(暂缺)
- fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
- HTML表单
- 关于request.getSession(true/false/null)的区别