布局代码如下:

<?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);
} }

最新文章

  1. RadioGroup、RadioButton、CheckBox、Toast用法
  2. Java 基础知识相关好文章
  3. 转 @html.ActionLink的几种参数格式
  4. Oracle 权限(grant、revoke)
  5. SQL疑难杂症【5 】大量数据查询的时候要考虑结果为空的情况
  6. Swift学习笔记七
  7. 数据库中join的用法(on、left。right)
  8. C++返回引用的函数
  9. 【设计模式 - 13】之责任链模式(Chain Of Responsibility)
  10. 【HDOJ】2424 Gary&#39;s Calculator
  11. SQL Server 2005无日志文件附加数据库
  12. LinqToSql增加、修改、删除---(转载)
  13. Jenkins-FQA
  14. git命令别名(Alias)
  15. 2019-04-15 Python中的面向对象学习总结
  16. install scrapy
  17. mktemp 命令
  18. vue缓存页面【二】
  19. java设计模式-----21、备忘录模式
  20. AD集成库元件简写中英文对照表

热门文章

  1. Android的WebView有哪些坑?
  2. 洛谷 P3302 [SDOI2013]森林 解题报告
  3. busybox根文件系统使用记录
  4. Python之多线程:Threading模块
  5. float存储
  6. 百度之星初赛(A)——T6
  7. 关于backBarButtonItem的N种方法
  8. shiro配置参考(二)可以和mybatis的配置放在一个文件中(不建议这样,可以拆分开来,注意相关配置即可)
  9. vim注释颜色更改
  10. Codeforces 628 B.New Skateboard