Android 系统自带隐式intent应用

本文介绍了如何在Android中使用隐式Intent来实现拨打电话、发送短信、打开网页、播放音乐和视频、查看图片、通知栏消息等功能。详细讲解了相关布局、权限设置和Intent的使用方法。
摘要由CSDN通过智能技术生成
完成效果:拨打电话,发送短信,播放音乐,播放视频,打开网页,查看图片,通知栏。
PopWindow中完成效果:拍照片,从相册选择照片并且可裁减。

首先在清单文件中加入如下权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


主布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    tools:context="com.example.administrator.jreduch07.IntentActivity">
    <com.example.administrator.jreduch07.RoundImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:id="@+id/riv"
        android:src="@mipmap/ruzixiaoge"
        android:layout_below="@+id/bt8"
        android:layout_centerHorizontal="true" />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt1"
        android:text="拨打电话"

        />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt2"
        android:text="发送短信"
        android:layout_below="@+id/bt1"
        android:layout_alignParentStart="true" />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt3"
        android:layout_below="@id/bt2"
        android:text="打开网页"
        />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt4"
        android:layout_below="@+id/bt3"
        android:text="播放音乐"
        />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt5"
        android:layout_below="@id/bt4"
        android:text="播放视频"
        />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt6"
        android:layout_below="@id/bt5"
        android:text="查看图片"
        />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bt7
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值