使用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" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/btn_webbrowser"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Web Browser"
android:onClick="onClickWebBrowser" />
<Button
android:id="@+id/btn_makcalls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Make Calls"
android:onClick="onClickMakeCalls" /> <Button
android:id="@+id/btn_showMap"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Show Map"
android:onClick="onClickShowMap" /> </LinearLayout>
Activity代码如下:
package com.lynx.intents; import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View; public class IntentsActivity extends Activity { int request_Code=1; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
} public void onClickWebBrowser(View view){
Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://www.amazon.com"));
startActivity(i);
} public void onClickMakeCalls(View view){
Intent i=new Intent(android.content.Intent.ACTION_DIAL,Uri.parse("tel:+13503350416"));
startActivity(i);
} public void onClickShowMap(View view){
Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("geo:37.827500,-122.481670"));
startActivity(i);
} }
使用Intent调用内置应用程序的更多相关文章
- Android开发之使用意图调用内置应用程序
意图可以调用活动,也常被用来调用内置应用程序,如加载web页面,拨号页面,内置地图应用等等.下面就用例子来说明该用法. 效果图如下: 实现代码如下: 上图中的启动MyBrowser是用意图来调用MyW ...
- Android学习笔记(十七)——使用意图调用内置应用程序
使用意图调用内置应用程序 1.创建一个新的Android项目并命名为Intents,在main.xml文件里加入两个Button: <Button android:id="@+id/b ...
- python函数基础:调用内置函数&定义函数
调用内置函数 有很多内置函数,在使用中需要积累.这里只举两个例子: 分别调用abs和数据类型转换,注意当入参类型错误时候会报错 ''' print('abs(-100)') abs(-100) pri ...
- 如果您想确保Windows 10在新用户登录时不安装内置应用程序,则必须删除所有配置的应用程序。
原文 如果您想确保Windows 10在新用户登录时不安装内置应用程序,则必须删除所有配置的应用程序. 本文的内容 已安装与配置的应用程序 删除配置的应用程序 安装与配置的应用程序^ 在介绍如何删除所 ...
- 写一个android内置android程序
当我们编译完毕android源代码之后,就须要对他做点什么事情,我如今正在看老罗的"Android源代码情景分析"一书.在这里主要是记录一些书中没有说清楚的地方. 相同.我们创建一 ...
- Android开发中内置apk程序
首先申明,这里的方法介绍是针对我司自己项目中的具体开发板而做的. Mg701内置APK有三种方式 一. 这种方法必须要自己编写Android.mk文件(关于Android.mk可以参考 ...
- Spring-boot内置的程序管理监控工具-Actuator
1.引入jar包: <dependencies> <dependency> <groupId>org.springframework.boot</groupI ...
- 【Python】Java程序员学习Python(四)— 内置方法和内置变量
<假如爱有天意> 当天边那颗星出现,你可知我又开始想念,有多少爱恋只能遥遥相望,就像月光洒向海面,年少的我们曾以为,相爱的人就能到永远,当我们相信情到深处在一起,听不见风中的叹息,谁知道爱 ...
- day 15 - 1 内置函数
内置函数 作用域相关 locals() globals() #这两组开始容易搞混 print(locals()) #返回本地作用域中的所有名字 print(globals()) #返回全局作用域中的所 ...
随机推荐
- Scala 基础(5)—— 构建函数式对象
有了 Scala 基础(4)—— 类和对象 的前提,现在就可以来构建一个基于 Scala 的函数式对象. 下面开始构造一个有理数对象 Rational. 1. 主构造方法和辅助构造方法 对于每一个类的 ...
- InfluxDB安装后web页面无法访问的解决方案
本文属于<InfluxDB系列教程>文章系列,该系列共包括以下 16 部分: InfluxDB学习之InfluxDB的安装和简介 InfluxDB学习之InfluxDB的基本概念 Infl ...
- 浅析_tmain() 与 main() 函数的区别
_tmain()是为了支持Unicode所使用的main的一个别名,既然是别名,应该有宏定义过的,在<stdafx.h>里 #include <stdio.h> #indlud ...
- Educational Codeforces Round 22 E. Army Creation
Educational Codeforces Round 22 E. Army Creation 题意:求区间[L,R]内数字次数不超过k次的这些数字的数量的和 思路:和求区间内不同数字的数量类似,由 ...
- 《c程序设计语言》读书笔记-5.5-指针实现strncpy,strncat,strncmp
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> ...
- poj 1390 区间dp
Blocks Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 5035 Accepted: 2065 Descriptio ...
- xdebug使用教程
http://www.cnblogs.com/xujian2016/p/5548921.html 配置信息 zend_extension="D:\phpStudy\php53n\ext\ph ...
- spring in action 学习十一:property placeholder Xml方式实现避免注入外部属性硬代码化
这里用到了placeholder特有的一个语言或者将表达形式:${},spring in action 描述如下: In spring wiring ,placeholder values are p ...
- hibernate中Configuration类的作用
问题:我们在获得一个SessionFactory对象的时候经常是写下面这行代码: SessionFactory sessionFactory = new Configuration().configu ...
- 汕头市队赛 SRM 07 A 你的麻将会排序吗
A 你的麻将会排序吗 SRM 07 曾经有过一些沉迷日麻的小孩纸,后来呀,他们都去寻找自己的世界了. kpm也是这样的小孩纸.他想有一只自动整理牌的机器.当麻将以给定的顺序进入机器时,通过机器的运转, ...