- 浏览: 3958995 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
-
hinuliba:
...
字体背景颜色的高度修改 -
KANGOD:
最后的 -createDialog() 私有方法是怎么回事,没 ...
简单的实现listView中item多个控件以及点击事件 -
sswangqiao:
呵呵,呵呵
onActivityResult传值的使用 -
yumeiqiao:
感觉你所的不清楚 lstView.setOnTouchLi ...
listview中viewflipper的问题 -
lizhou828:
果然是大神啊!!!
Animation动画效果的实现
//show webapp: Uri uri = Uri.parse("http://www.google.com"); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it); //show maps: Uri uri = Uri.parse("geo:38.899533,-77.036476"); Intent it = new Intent(Intent.Action_VIEW,uri); startActivity(it); //show ways Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en"); Intent it = new Intent(Intent.ACTION_VIEW,URI); startActivity(it); //call dial program Uri uri = Uri.parse("tel:xxxxxx"); Intent it = new Intent(Intent.ACTION_DIAL, uri); startActivity(it); Uri uri = Uri.parse("tel.xxxxxx"); Intent it =new Intent(Intent.ACTION_CALL,uri); //don't forget add this config:<uses-permission id="android.permission.CALL_PHONE" /> //send sms/mms //call sender program Intent it = new Intent(Intent.ACTION_VIEW); it.putExtra("sms_body", "The SMS text"); it.setType("vnd.android-dir/mms-sms"); startActivity(it); //send sms Uri uri = Uri.parse("smsto:0800000123"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", "The SMS text"); startActivity(it); //send mms Uri uri = Uri.parse("content://media/external/images/media/23"); Intent it = new Intent(Intent.ACTION_SEND); it.putExtra("sms_body", "some text"); it.putExtra(Intent.EXTRA_STREAM, uri); it.setType("image/png"); startActivity(it); //send email Uri uri = Uri.parse("mailto:xxx@abc.com"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); startActivity(it); Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com"); it.putExtra(Intent.EXTRA_TEXT, "The email body text"); it.setType("text/plain"); startActivity(Intent.createChooser(it, "Choose Email Client")); Intent it=new Intent(Intent.ACTION_SEND); String[] tos={"me@abc.com"}; String[] ccs={"you@abc.com"}; it.putExtra(Intent.EXTRA_EMAIL, tos); it.putExtra(Intent.EXTRA_CC, ccs); it.putExtra(Intent.EXTRA_TEXT, "The email body text"); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.setType("message/rfc822"); startActivity(Intent.createChooser(it, "Choose Email Client")); //add extra Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3"); sendIntent.setType("audio/mp3"); startActivity(Intent.createChooser(it, "Choose Email Client")); //play media Intent it = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///sdcard/song.mp3"); it.setDataAndType(uri, "audio/mp3"); startActivity(it); Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //Uninstall Uri uri = Uri.fromParts("package", strPackageName, null); Intent it = new Intent(Intent.ACTION_DELETE, uri); startActivity(it); //uninstall apk Uri uninstallUri = Uri.fromParts("package", "xxx", null); returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri); //install apk Uri installUri = Uri.fromParts("package", "xxx", null); returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); //play audio Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3"); returnIt = new Intent(Intent.ACTION_VIEW, playUri); //send extra Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/eoe.mp3"); sendIntent.setType("audio/mp3"); startActivity(Intent.createChooser(it, "Choose Email Client")); //search Uri uri = Uri.parse("market://search?q=pname:pkg_name"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //where pkg_name is the full package path for an application //show program detail page Uri uri = Uri.parse("market://details?id=app_id"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); //where app_id is the application ID, find the ID //by clicking on your application on Market home //page, and notice the ID from the address bar //search google Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY,"searchString") startActivity(intent);
发表评论
-
URI 转path
2019-06-26 10:41 1347转自知乎Matisse package com.zhihu ... -
权限申请
2017-09-22 13:25 1280public class PermissionActivit ... -
onPreviewFrame 相机输出格式转换yuv420p保存成图片
2015-11-25 15:59 7617在最近项目中,因为特殊需要,底层相机往外输出了i420 也 ... -
new Android's Runtime Permission
2015-11-03 21:05 1257targetSdkVersion 23 开始 使用运行时权 ... -
自定义listview 边缘效果
2015-02-28 10:58 1755static void ChangeEdgeEffect( ... -
发射打开wifi
2015-01-07 10:25 1453WifiManager wifiManager = (Wif ... -
RecyclerView
2014-11-05 13:08 1297http://www.grokkingandroid.com ... -
获取点击区域
2014-04-28 09:39 1596@Override public void getHitR ... -
speex 和libogg 编译
2014-04-03 16:17 6420下载: http://www.speex.org/down ... -
rsync 同步
2014-03-28 17:06 1853两台android 设备 进行rsy ... -
流转字符串
2014-03-11 09:49 1570public static String convertSt ... -
java simplexml 序列化
2014-03-06 13:22 5995<?xml version="1.0&quo ... -
获取其他程序的特定资源
2014-03-05 09:33 1709try { PackageManager man ... -
检测来电属于哪个sim卡
2014-02-07 10:41 1748public class IncomingCallInter ... -
使用 NDK r9 编译ffmpeg
2014-01-16 13:32 168691. 环境 ubuntu 我的是13.10 ndk r9 ... -
android h264含so
2014-01-13 11:24 1569http://download.csdn.net/downlo ... -
xml转义字符
2013-12-18 09:29 1609" " ' & ... -
字体背景颜色的高度修改
2013-12-11 10:31 4257当使用android:lineSpacingExtra= ... -
屏保的实现
2013-12-07 10:27 2854最近需要做一个屏保,开始以为很简单,因为系统本身就带了屏保功 ... -
PreferenceActivity下嵌套PreferenceScreen在其它布局中
2013-11-21 16:32 9197今天在修改系统代码的时候,系统代码用了PreferenceA ...
相关推荐
Android Intent 使用总结 Android Intent 是 Android 组件之间通讯的核心机制,它负责对应用中一次操作的动作、动作涉及数据、附加数据进行描述。Android 则根据 Intent 的描述,找到对应的组件,将 Intent 传递给...
本篇文章将深入探讨Intent的基本概念、类型、构造方法以及如何在Android中有效地使用Intent。 Intent是一种意图声明,表达了应用程序想要执行的操作。在Android系统中,Intent分为显式Intent和隐式Intent两种类型。...
Intent分为显式Intent和隐式Intent,而"Intent总结04 Data和Type属性"主要聚焦于Intent的数据(data)和类型(type)两个关键属性,它们在创建Intent时发挥着至关重要的作用。 1. **Intent的数据(data)**: Intent的数据...
在标题提到的“Intent使用示例(一)”中,我们将重点关注`startActivityForResult`方法。这个方法通常用于启动一个Activity,并期望在新Activity执行完某些操作后返回结果。当用户在新Activity中完成任务,如选择照片...
下面是对Intent的详细总结: 1. **Intent的基本类型** - 显式Intent:指定要启动的具体组件(Activity或Service),通过类名或组件的ComponentName来明确指定。 - 隐式Intent:不指定具体组件,而是定义一个行动...
- 要指定完整的Data(包括Type和具体的URI),必须使用 `setDataAndType()` 方法,避免先后调用 `setData()` 和 `setType()` 导致值被覆盖。 10. **Scheme 的匹配**: - Scheme的匹配规则也需要遵循Intent与`...
发送Intent时,可以使用`startActivity(intent)`或`startService(intent)`方法。而接收方则需要在onCreate()或onStartCommand()方法中处理Intent,通过`intent.getAction()`获取Action并进行相应操作。 七、Intent ...
总结,使用Intent打开网页是Android开发中的常见操作,既可以调用系统浏览器实现跨应用的浏览,也可以借助WebView在应用内部加载网页。选择哪种方式取决于应用场景,如需保持用户在应用内的体验,WebView是理想选择...
总结,Intent是Android系统中连接各个组件的桥梁,理解并熟练使用Intent对于开发Android应用至关重要。在实际项目中,Intent不仅可以用于启动Activity和Service,还可以用于启动BroadcastReceiver,实现各种组件间的...
初学移动应用公开发中的Android开发,实验四的主要内容为intent的使用,通过这一次实验,掌握基本的intent使用方法。 具体实验分析 实验第一步:阅读官方文档:intent 实验解析:本次实验共分为两个部分。第一个部分...
总结,Intent在Android开发中扮演着至关重要的角色,无论是启动组件、传递数据还是实现组件间的通信,都离不开Intent的使用。理解和熟练掌握Intent的用法,是成为一名合格的Android开发者的基础。通过不断地实践和...
创建Intent通常使用以下构造方法: - `Intent(Context packageContext, Class<?> cls)`: 创建显式Intent,传入上下文和目标组件的Class。 - `Intent(String action)`: 创建隐式Intent,只设置Action。 - `Intent...
- 启动Activity:通过`startActivity(Intent)`方法启动Activity,Intent中可以携带数据。 - 启动Service:使用`startService(Intent)`或`bindService(Intent, ServiceConnection, int)`启动或绑定Service。 - ...
总结来说,Intent是Android系统中的核心组成部分,它的多种用法包括显式和隐式Intent的创建、Intent Filter的定义、数据的传递以及调用系统服务和第三方应用。熟练掌握Intent的使用,将有助于提升Android应用的交互...
本文将深入讲解Intent在广播和服务中的使用方法,以实例的形式帮助开发者更好地理解Intent的用法。 一、Intent的基本概念 Intent在Android中扮演着消息传递者的角色,它封装了操作类型和数据,并在组件之间传递。...
首先,定义一个方法获取文件的MIME类型,然后创建一个Intent,设置ACTION_VIEW动作,使用getDataAndType()方法设置文件Uri和其MIME类型,最后启动Intent。 ```java private void openFile(File f) { Intent intent...
通过调用`putExtra()`方法,可以在Intent中添加额外的数据,这些数据可以在目标组件中通过`getExtra()`方法获取。这可以是各种类型的数据,如字符串、整数、浮点数、布尔值,甚至是自定义对象。 4. **启动组件** ...
以上就是关于Intent的全面总结,它是Android框架中的关键部分,熟练掌握Intent的使用对于构建功能丰富的Android应用至关重要。通过深入理解Intent的各个组件和功能,开发者能够更好地控制应用的流程和交互。
2. 启动Service:使用startService()或bindService(),配合Service的相关生命周期方法。 3. 发送Broadcast:使用sendBroadcast()、sendOrderedBroadcast()或send StickyBroadcast(),广播接收器通过onReceive()接收...
本文将详细探讨如何使用Intent来实现Android中的Video功能。 首先,我们要理解Android的MediaStore类。MediaStore是Android系统提供的一个数据库,它包含了设备上的所有媒体文件,包括图片、音频和视频。通过...