第六篇-以隐式意图(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负责对应用中一次操作的动作.动作涉及数据. ...
随机推荐
- 图解Python的直接赋值与浅拷贝和深度拷贝三者区别
直接赋值:其实就是对象的引用(别名). 浅拷贝(copy):拷贝父对象,不会拷贝对象的内部的子对象. 深拷贝(deepcopy): copy 模块的 deepcopy 方法,完全拷贝了父对象及其子对象 ...
- k8s HPA自动收缩
HPA自动收缩 autoscale 自动调整一个 Deployment, ReplicaSet, 或者 ReplicationController 的副本数量 #创建一个replicaset测试 [r ...
- React Native & Google & Proxy
React Native & Google & Proxy https://snack.expo.io/ https://expo.io/snacks/@xgqfrms https:/ ...
- 有时候做JQ动画,鼠标经过,它会不停自己抖动不停,解决方法(此处,是兼容IE ,当鼠标经过,遮罩层从下移到上边的JQ动画效果)
<style> .x_sdbb { margin: 60px 0 40px 0; } .x_title2{ background: url(../images/hdb_img17.png) ...
- php1
正则表达式 $p = '/name:(\w+\s?\w+)/'; $str = "name:steven jobs"; preg_match($p, $str, $match); ...
- Windows 7 SP1 x64 LSP
NALapi.dll napinsp.dll pnrpnsp.dll mswsock.dll winrnr.dll
- 启动docker容器 防火墙问题报错 ! -i docker0' failed: iptables: No chain/target/match by that name.
COMMAND_FAILED: '/sbin/iptables -t nat -A DOCKER -p tcp -d 0/0 --dport 8111 -j DNAT --to-destination ...
- python 模块之-shelve
shelve模块比pickle模块简单,只有一个open函数,返回类似字典的对象,可读可写;key必须为字符串,而值可以是python所支持的数据类型 import shelve f = shelve ...
- POI Excel 单元格内容类型判断并取值
个人用到的 String birthdayVal = null; ...
- setTimeout运行机制简要理解
经典例子辅助理解setTimeout工作原理 运行结果: 约1秒后输出:1,再过约1秒后输出:2,接着才立即输出:时间流逝了: 2002 毫秒最后输出:时间又流逝了: 2003 毫秒 在现有浏览器环境 ...