第六篇-以隐式意图(Implicit Intent)呼叫系统服务
一、新建一个layout5.xml,同样换为constriant模式。
二、拖动两个Button到预览界面,第一个按钮名字改为DISPLAY WEBPAGE,第二个按钮名字改为MAKE A CALL。第一个按钮连接上左右。width改为match。第二个按钮连接左右,上方连第一个按钮的下方。width改为match,与第一个按钮的距离改为16。切换到text模式,在第一个按钮下添加android:onClick="openWebpage";第二个按钮下添加android:onClick=makecall";alt+enter就在.java文件下建了这两个函数。
三、切换到main.java:

效果就是,点击DISPLAY WEBPAGE按钮会跳到苹果界面。

效果就是点击按钮,会出现以下界面

layout5.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"> <Button
android:id="@+id/button11"
android:onClick="openWebpage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="DISPLAY WEBPAGE"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> <Button
android:id="@+id/button12"
android:onClick="makecall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="MAKE A CALL"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button11" />
</android.support.constraint.ConstraintLayout>
main.xml:
package com.example.aimee.aimeetest1; import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View; public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.layout);
setContentView(R.layout.layout5);
} public void JumpToScreen2(View view) {
Intent i=new Intent(this,Layout4Activity.class);
startActivity(i);
} public void openWebpage(View view) {
Intent i=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
startActivity(i);
} public void makecall(View view) { Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse("tel:***********"));
startActivity(i);
}
}
第六篇-以隐式意图(Implicit Intent)呼叫系统服务的更多相关文章
- 第五篇-以显式意图(Explicit Intent)跳往其它Activity
此项目基于第四篇. Intent(意图) Explicit Intent(显式意图): 清楚指明需要前往的Activity的名称 用于APP内部的连接 Inplicit Intent(隐式意图): 不 ...
- 显示转换explicit和隐式转换implicit
用户自定义的显示转换和隐式转换 显式转换implicit关键字告诉编译器,在源代码中不必做显示的转型就可以产生调用转换操作符方法的代码. 隐式转换implicit关键字告诉编译器只有当源代码中指定了显 ...
- 隐式意图启动一个Activity
隐式意图是通过指定一组动作或者属性实现,主要用于跨应用使用. 1.创建一个意图对象 Intent intent = new Intent(); 2.设置意图过滤器 intent.setAction(& ...
- Android 隐式意图和显示意图的使用场景
本文实现一个隐式意图的应用,激活短信应用 public void click4(View view) { Intent intent = new Intent(); intent.setAction( ...
- Android 隐式意图的配置
本文地址:http://www.cnblogs.com/wuyudong/p/5677473.html,转载请注明源地址. <Android 显示意图激活另外一个Actitity>一文介绍 ...
- Android 隐式意图激活另外一个Actitity
上篇文章<Android 显示意图激活另外一个Actitity>最后谈到显示意图激活另外一个Actitity会有一些局限性和弊端 本文介绍另一种方法:隐式意图激活另外一个Actitity ...
- 无废话Android之smartimageview使用、android多线程下载、显式意图激活另外一个activity,检查网络是否可用定位到网络的位置、隐式意图激活另外一个activity、隐式意图的配置,自定义隐式意图、在不同activity之间数据传递(5)
1.smartimageview使用 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&q ...
- 隐式意图Intent
在我们想往下一个页面传递数据时,要想到显式意图和隐式意图,显示意图用于内部活动跳转时比较方便,而隐式意图用于应用程序中外部活动的跳转时较为方便,在使用隐式意图时我们要想到清单文件 代码如下: < ...
- 支付SDK的安全问题——隐式意图可导致钓鱼攻击
该漏洞涉及到app所使用的intent和intent filter. intent是一个可用于从一个app组件请求动作或处理事件的“消息对象”.Intent负责对应用中一次操作的动作.动作涉及数据. ...
随机推荐
- Airflow 使用随笔(内含 TimeZone 和 Backfill 等的详解)
其实怎么部署 airflow 又哪些特性,然后功能又是如何全面都可以在 Reference 的文章里面找到,都不是重点这里就不赘述了. 这里重点谈一下我在部署完成仔细阅读文档之后觉得可以总结的一些东 ...
- SpringMVC配置三大组件
1.组件扫描器 使用组件扫描器省去在spring容器配置每个Controller类的繁琐. 使用<context:component-scan>自动扫描标记@Controller的控制器类 ...
- pooling的几种形式(转)
转载地址:http://blog.csdn.net/malefactor/article/details/51078135 原作者:张俊林 CNN是目前自然语言处理中和RNN并驾齐驱的两种最常见 ...
- sql行转列实例
select gh ,xm , max(A.bz) as bz , max(A.jcz) as jcz , max(A.dl) as dl , max(A.czzx) as czzx , max(A. ...
- QXcbConnection: Could not connect to display
import matplotlib; matplotlib.use('agg') 注意:要添加到所有matplotlib前面,否则不起作用
- 页面传递的都是string ; 每个标签要有name的原因是为了取值 因为传递给后台是键值对的形式
页面传递的都是string ; 每个标签要有name的原因是为了取值 因为传递给后台是键值对的形式
- P1308 统计单词数
P1308 题目描述 一般的文本编辑器都有查找单词的功能,该功能可以快速定位特定单词在文章中的位置,有的还能统计出特定单词在文章中出现的次数. 现在,请你编程实现这一功能,具体要求是:给定一个单词,请 ...
- P1200 你的飞碟在这儿
P1200 题目描述 众所周知,在每一个彗星后都有一只UFO.这些UFO时常来收集地球上的忠诚支持者.不幸的是,他们的飞碟每次出行都只能带上一组支持者. 因此,他们要用一种聪明的方案让这些小组提前知道 ...
- 【AGC005F】Many Easy Problems FFT 容斥原理
题目大意 给你一棵树,有\(n\)个点.还给你了一个整数\(k\). 设\(S\)为树上某些点的集合,定义\(f(S)\)为最小的包含\(S\)的联通子图的大小. \(n\)个点选\(k\)个点一共有 ...
- bzoj 1257: [CQOI2007]余数之和 (数学+分块)
Description 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值 其中k mod i表示k除以i的余数. 例如j(5 ...