Data属性介绍











使用Data和Action属性启动系统Activity

代码示例

public class MainActivity extends Activity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void btn(View view){
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        String data  = "http://www.baidu.com";
        Uri dataUri = Uri.parse(data);
        intent.setData(dataUri);
        startActivity(intent);
    }
    public void edit(View view){
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_EDIT);
        String data  = "content://com.android.contacts/contacts/1";
        Uri dataUri = Uri.parse(data);
        intent.setData(dataUri);
        startActivity(intent);
    }
   public void call(View view){
       Intent intent = new Intent();
       intent.setAction(Intent.ACTION_DIAL);
       String data  = "tel:18710849943";
       Uri dataUri = Uri.parse(data);
       intent.setData(dataUri);
       startActivity(intent);
   }
}

布局代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    >
  <Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:id="@+id/btn"
      android:text="btn"/>
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnEdit"
        android:text="edit"/>
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/call"
        android:text="call"/>

</LinearLayout>

Flag属性







Intent的Data和Type和Flag属性-amdroid学习之旅(五十一)的更多相关文章

  1. Intent的属性及Intent-filter配置——Data、Type属性与intent-filter配置

    Data属性通常用于向Action属性提供操作的数据,Data属性接受一个Uri对象,一个Uri对象通常通过如下形式的字符串来表示: content://com.android.contacts/co ...

  2. Intent属性详解三 data、type和extra

    1 Data  执行时要操作的数据 在目标<data/>标签中包含了以下几种子元素,他们定义了url的匹配规则: android:scheme 匹配url中的前缀,除了“http”.“ht ...

  3. Intent的属性及Intent-filter配置——Extra属性——Flag属性

    Intent的Extra属性通常用于在多个Action之间进行数据交换,Intent的Extra属性值应该是一个Bundle对象,Bundle对象的就像一个Map对象,它可以存入多组key-value ...

  4. Intent 的Flag属性(Activity在栈位置的主宰者)

    Intent 的Flag属性可用来控制Activity在栈中的排列位置,本文列举了常见的Flag. 例--(以无动画方式启动ActivityB): Intent intent=new Intent(A ...

  5. Android 之Activity启动模式(二)之 Intent的Flag属性

    首页博客链接关于我留言板 前面介绍了通过launchMode设置Activity的启动模式.本章接着介绍Activity的启动模式相关内容,讲解的内容是Intent与启动模式相关的Flag,以及and ...

  6. TYPES、DATA、TYPE、LIKE、CONSTANTS、STATICS、TABLES

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. [Oracle维护工程师手记]Data Guard Broker中改属性是否需要两侧分别执行?

    Data Guard Broker中改属性是否需要两侧分别执行? Data Guard Broker有一些属性,可以通过 show configuration 看到.我有时会想,这些个属性,是否是分别 ...

  8. [AJAX系列]$.get(url,[data],[fn],[type])

    $.get(url,[data],[fn],[type]) 概述 通过远程HTTP GET请求载入信息 参数 url:待载入页眉的URL地址 data:待发送key/value参数 callback: ...

  9. jQuery.post(url, [data], [callback], [type])

    jQuery.post(url, [data], [callback], [type]) 概述 通过远程 HTTP POST 请求载入信息. 这是一个简单的 POST 请求功能以取代复杂 $.ajax ...

随机推荐

  1. C语言程序设计第四次作业——选择结构(二)

    (一)改错题 错误信息: 错误原因:第13行sqrt数学函数缺少")",导致编译器无法将括号正确配对 改正方法:补齐缺少的")" 错误信息: 错误原因:if语句 ...

  2. 记录一次widora sdk编译ipk 实战编译redis

      因为业务需求,需要用到redis存储一点简单的数据,因为redis有良好的哈希机制,可以完美实现我的某些需求,但openwrt官方提供memcached的ipk并没有提供redis,没办法,只能自 ...

  3. 携程Java后台开发三面面经

    前言 携程是我面试的第一个互联网公司,投递的岗位是后台开发实习生,总共面了三面,止步于人才库.中间兜兜转转,复杂的心理活动,不足与外人道也.唯有面试的技术部分与大家共享. 宣讲会完了之后有个手写代码的 ...

  4. js数组求差集

    var arr1 = [2,3,5,88,99,444,66];var arr2 = [2,88,66]; arr_dive(arr1,arr2); function arr_dive(aArr,bA ...

  5. IOS JavaScriptCore介绍

    本文主要转自:https://www.jianshu.com/p/cdaf9bc3d65d http://blog.csdn.net/u011993697/article/details/515772 ...

  6. Windows上安装scapy

    1. 环境: (1) 操作系统:win7 .server2012 (2) Python版本:Python3.6-64bit (3) 依赖模块Npcap(推荐) 或WinPcap.   ps:从logo ...

  7. 解决Spring Boot 使用RedisTemplate 存储键值出现乱码 \xac\xed\x00\x05t\x00

    spring-data-redis的RedisTemplate<K, V>模板类在操作redis时默认使用JdkSerializationRedisSerializer来进行序列化解决方法 ...

  8. JVM常见问题 一(转载)

    1. 内存模型以及分区 JVM内存模型如下图所示: 此处我们集中注意中间绿色的部分,该部分为JVM的运行时内存,该部分包含了: 线程私有的(灰色): 程序计数器:记录执行到第几条指令 虚拟机方法栈:执 ...

  9. java中的final和volatile详解

    相比synchronized,final和volatile也是经常使用的关键字,下面聊一聊这两个关键字的使用和实现 1.使用 final使用: 修饰类表示该类为终态类,无法被继承 修饰方法表示该方法无 ...

  10. xshell连接centos与ubuntu

    操作系统:Windows 7 应用软件:Ware Workstation &Xshell 5 Linux:CentOS 7 Minimal &Ubuntu Server 16 ==== ...