当前位置:首页 » 安卓系统 » androidintent大全

androidintent大全

发布时间: 2023-01-31 12:46:07

‘壹’ android 怎么intent

Intent intent = new Intent(this,目标Activity.class);
startActivity(intent);
这个就是示例

‘贰’ android的intent

IntentFilter是对于符合条件的activity进行过滤, 要想进行动作拦截建议使用BroadcastReceiver ,根据action部分确定拦截,。。 拦截Android手机发出的短信好像只能监听到发送中和发送完毕的动作,要想拦截系统发出短信并加上自己的标识好像不修改底端是做不到的

‘叁’ Android开发之Intent.Action Android中Intent的各种常见作用【转】

1 Intent.ACTION_MAIN

String: Android.intent.action.MAIN标识Activity为一个程序的开始。比较常用。Input:nothingOutput:nothing

2 Intent.Action_CALL

【直接呼叫,在6.0之后的版本需要获取权限,详见 Android开发学习之路-Android6.0运行时权限【转】 】

Stirng: android.intent.action.CALL呼叫指定的电话号码。Input:电话号码。数据格式为:tel:+phone number Output:Nothing

Intent intent=new Intent(); intent.setAction(Intent.ACTION_CALL);

intent.setData(Uri.parse("tel:1320010001");

startActivity(intent);

3 Intent.Action.DIAL

String: action.intent.action.DIAL调用拨号面板

Intent intent=new Intent();intent.setAction(Intent.ACTION_DIAL);  //android.intent.action.DIAL

intent.setData(Uri.parse("tel:1320010001");

startActivity(intent);

Input:电话号码。数据格式为:tel:+phone number Output:Nothing说明:打开Android的拨号UI。如果没有设置数据,则打开一个空的UI,如果设置数据,action.DIAL则通过调用getData()获取电话号码。但设置电话号码的数据格式为 tel:+phone number.

4 Intent.Action.ALL_APPS

String: andriod.intent.action.ALL_APPS列出所有的应用。Input:Nothing.Output:Nothing.

5Intent.ACTION_ANSWER

Stirng:android.intent.action.ANSWER处理呼入的电话。Input:Nothing.Output:Nothing.

6 Intent.ACTION_ATTACH_DATA

String: android.action.ATTCH_DATA别用于指定一些数据应该附属于一些其他的地方,例如,图片数据应该附属于联系人Input: DataOutput:nothing

7 Intent.ACTION_BUG_REPORT

String: android.intent.action.BUG_REPORT显示Dug报告。Input:nothingoutput:nothing

8 Intent.Action_CALL_BUTTON

String: android.action.intent.CALL_BUTTON.相当于用户按下“拨号”键。经测试显示的是“通话记录”Input:nothingOutput:nothing

Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);startActivity(intent);

9 Intent.ACTION_CHOOSER

String: android.intent.action.CHOOSER显示一个activity选择器,允许用户在进程之前选择他们想要的,与之对应的是Intent.ACTION_GET_CONTENT.

10. Intent.ACTION_GET_CONTENT

String: android.intent.action.GET_CONTENT允许用户选择特殊种类的数据,并返回(特殊种类的数据:照一张相片或录一段音)

Input: TypeOutput:URI

int requestCode = 1001;Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // "android.intent.action.GET_CONTENT"

intent.setType("image/*"); // 查看类型,如果是其他类型,比如视频则替换成 video/*,或 */*

Intent wrapperIntent = Intent.createChooser(intent, null);startActivityForResult(wrapperIntent, requestCode);

11 Intent.ACTION_VIEW

String:android.intent.action.VIEW用于显示用户的数据。比较通用,会根据用户的数据类型打开相应的Activity。比如 tel:13400010001打开拨号程序,http://www.g.cn则会打开浏览器等。

Uri uri = Uri.parse("http://www.google.com"); //浏览器 Uri uri =Uri.parse("tel:1232333"); //拨号程序

Uri uri=Uri.parse("geo:39.899533,116.036476"); //打开地图定位

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

//播放视频

Intent intent = new Intent(Intent.ACTION_VIEW);

Uri uri = Uri.parse("file:///sdcard/media.mp4");

intent.setDataAndType(uri, "video/*");

startActivity(intent);

//调用发送短信的程序

Intent it = new Intent(Intent.ACTION_VIEW);

it.putExtra("sms_body", "信息内容...");

it.setType("vnd.android-dirs-sms");

startActivity(it);

12 Intent.ACTION_SENDTO

String: android.intent.action.SENDTO

说明:发送短信息

//发送短信息 Uri uri = Uri.parse("smsto:13200100001");

Intent it = new Intent(Intent.ACTION_SENDTO, uri);

it.putExtra("sms_body", "信息内容...");

startActivity(it);

//发送彩信,设备会提示选择合适的程序发送 Uri uri = Uri.parse("content://media/external/images/media/23");

//设备中的资源(图像或其他资源)

Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra("sms_body", "内容");

intent.putExtra(Intent.EXTRA_STREAM, uri);

intent.setType("image/png");

startActivity(it);

//Email Intent intent=new Intent(Intent.ACTION_SEND);

String[] tos={"[email protected]"};

String[] ccs={"[email protected]"};

intent.putExtra(Intent.EXTRA_EMAIL, tos);

intent.putExtra(Intent.EXTRA_CC, ccs);

intent.putExtra(Intent.EXTRA_TEXT, "The email body text");

intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

intent.setType("message/rfc822");

startActivity(Intent.createChooser(intent, "Choose Email Client"));

13 Intent.ACTION_GET_CONTENT

//选择图片 requestCode 返回的标识

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); //"android.intent.action.GET_CONTENT"

intent.setType(contentType); //查看类型 String IMAGE_UNSPECIFIED = "image/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//添加音频

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(contentType); //String VIDEO_UNSPECIFIED = "video/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//拍摄视频

int rationLimit = getVideoCaptureDurationLimit(); //SystemProperties.getInt("ro.media.enc.lprof.ration", 60);

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, sizeLimit);

intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, rationLimit);

startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO);

//视频

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(contentType); //String VIDEO_UNSPECIFIED = "video/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//录音

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(ContentType.AUDIO_AMR); //String AUDIO_AMR = "audior";

intent.setClassName("com.android.soundrecorder",

"com.android.soundrecorder.SoundRecorder");

((Activity) context).startActivityForResult(intent, requestCode);

//拍照 REQUEST_CODE_TAKE_PICTURE 为返回的标识

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //"android.media.action.IMAGE_CAPTURE";

intent.putExtra(MediaStore.EXTRA_OUTPUT, Mms.ScrapSpace.CONTENT_URI); // output,Uri.parse("content:/s/scrapSpace");

startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE);

‘肆’ android中intent的作用 越详细越好

1 Intent.ACTION_MAIN

String: android.intent.action.MAIN

标识Activity为一个程序的开始。比较常用。

Input:nothing

Output:nothing

例如:

1
2
3
4
5
6

也可以直接在程序中实现 Intent it = new Intent(原Activity.class,需跳转Activity.class);
2 Intent.Action_CALL

Stirng: android.intent.action.CALL

呼叫指定的电话号码。

Input:电话号码。数据格式为:tel:+phone number

Output:Nothing

Intent intent=new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);

3 Intent.Action.DIAL

String: action.intent.action.DIAL

调用拨号面板

Intent intent=new Intent();
intent.setAction(Intent.ACTION_DIAL); //android.intent.action.DIAL
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);

Input:电话号码。数据格式为:tel:+phone number

Output:Nothing

说明:打开Android的拨号UI。如果没有设置数据,则打开一个空的UI,如果设置数据,action.DIAL则通过调用getData()获取电话号码。

但设置电话号码的数据格式为 tel:+phone number.

4.Intent.Action.ALL_APPS

String: andriod.intent.action.ALL_APPS

列出所有的应用。

Input:Nothing.

Output:Nothing.

5.Intent.ACTION_ANSWER

Stirng:android.intent.action.ANSWER

处理呼入的电话。

Input:Nothing.

Output:Nothing.

6 Intent.ACTION_ATTACH_DATA

String: android.action.ATTCH_DATA

别用于指定一些数据应该附属于一些其他的地方,例如,图片数据应该附属于联系人

Input: Data

Output:nothing

7 Intent.ACTION_BUG_REPORT

String: android.intent.action.BUG_REPORT

显示Dug报告。

Input:nothing

output:nothing

8 Intent.Action_CALL_BUTTON

String: android.action.intent.CALL_BUTTON.

相当于用户按下“拨号”键。经测试显示的是“通话记录”

Input:nothing

Output:nothing

Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
startActivity(intent);

9 Intent.ACTION_CHOOSER

String: android.intent.action.CHOOSER

显示一个activity选择器,允许用户在进程之前选择他们想要的,与之对应的是Intent.ACTION_GET_CONTENT.

10. Intent.ACTION_GET_CONTENT

String: android.intent.action.GET_CONTENT

允许用户选择特殊种类的数据,并返回(特殊种类的数据:照一张相片或录一段音)

Input: Type

Output:URI

这个以前用到过,看事例。

选择一个图片:

代码
int requestCode = 1001;

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // "android.intent.action.GET_CONTENT"
intent.setType("image/*"); // 查看类型,如果是其他类型,比如视频则替换成 video/*,或 */*
Intent wrapperIntent = Intent.createChooser(intent, null);
startActivityForResult(wrapperIntent, requestCode);

‘伍’ 大学期末复习 android 中 intent组件的属性有哪些

Intent主要有以下四个重要属性,它们分别为:
Action:Action属性的值为一个字符串,它代表了系统中已经定义了一系列常用的动作。通过setAction()方法或在清单文件AndroidManifest.xml中设置。默认为:DEFAULT。
Data:Data通常是URI格式定义的操作数据。例如:tel:// 。通过setData()方法设置。
Category:Category属性用于指定当前动作(Action)被执行的环境。通过addCategory()方法或在清单文件AndroidManifest.xml中设置。默认为:CATEGORY_DEFAULT。
Extras:Extras属性主要用于传递目标组件所需要的额外的数据。通过putExtras()方法设置。
四个属性各自的常用值如下所示:
Action:
ACTION_MAIN:Android Application的入口,每个Android应用必须且只能包含一个此类型的Action声明。
ACTION_VIEW:系统根据不同的Data类型,通过已注册的对应Application显示数据。
ACTI ON_EDIT:系统根据不同的Data类型,通过已注册的对应Application编辑示数据。
ACTION_DIAL:打开系统默认的拨号程序,如果Data中设置了电话号码,则自动在拨号程序中输入此号码。
ACTION_CALL:直接呼叫Data中所带的号码。
ACTION_ANSWER:接听来电。
ACTION_SEND:由用户指定发送方式进行数据发送操作。
ACTION_SENDTO:系统根据不同的Data类型,通过已注册的对应Application进行数据发送操作。
ACTION_BOOT_COMPLETED:Android系统在启动完毕后发出带有此Action的广播(Broadcast)。
ACTION_TIME_CHANGED:Android系统的时间发生改变后发出带有此Action的广播(Broadcast)。
ACTION_PACKAGE_ADDED:Android系统安装了新的Application之后发出带有此Action的广播(Broadcast)。
ACTION_PACKAGE_CHANGED:Android系统中已存在的Application发生改变之后(如应用更新操作)发出带有此Action的广播(Broadcast)。
ACTION_PACKAGE_REMOVED:卸载了Android系统已存在的Application之后发出带有此Action的广播(Broadcast)。
Category:
CATEGORY_DEFAULT:Android系统中默认的执行方式,按照普通Activity的执行方式执行。
CATEGORY_HOME:设置该组件为Home Activity。
CATEGORY_PREFERENCE:设置该组件为Preference。
CATEGORY_LAUNCHER:设置该组件为在当前应用程序启动器中优先级最高的Activity,通常为入口ACTION_MAIN配合使用。
CATEGORY_BROWSABLE:设置该组件可以使用浏览器启动。
CATEGORY_GADGET:设置该组件可以内嵌到另外的Activity中。
Extras:
EXTRA_BCC:存放邮件密送人地址的字符串数组。
EXTRA_CC:存放邮件抄送人地址的字符串数组。
EXTRA_EMAIL:存放邮件地址的字符串数组。
EXTRA_SUBJECT:存放邮件主题字符串。
EXTRA_TEXT:存放邮件内容。
EXTRA_KEY_EVENT:以KeyEvent对象方式存放触发Intent的按键。
EXTRA_PHONE_NUMBER:存放调用ACTION_CALL时的电话号码。
Data:
tel://:号码数据格式,后跟电话号码。
mailto://:邮件数据格式,后跟邮件收件人地址。
smsto://:短息数据格式,后跟短信接收号码。
content://:内容数据格式,后跟需要读取的内容。
file://:文件数据格式,后跟文件路径。
market://search?q=pname:pkgname:市场数据格式,在Google Market里搜索包名为pkgname的应用。
geo://latitude, longitude:经纬数据格式,在地图上显示经纬度所指定的位置。

‘陆’ android中Intent问题

Android 开发网站上解释了一下,如果你想允许其它的app通过 intent-filter 命中你的 app 启动它,我们需要给我们的 app 添加 default category,一般来说没有 default category 是表示这个 activity 肯定只是我们 app 自己使用,比如我们一个app有多个 activity,只有主控 activity 会访问其它的 activity 时就是这样的。因为隐含地启动一个 app 的方式是通过对比 intent 条件的,我们没有指定 default category 就是表示我们不打算被其它程序隐含地启动(比如我们想放个木马什么的)。

这个文档说明了,想以隐含方式启动 activity 就需要添加 default category,这是因为需要允许其它app来启动你的activity (而启动自己的activity甚至可以直接使用类名来,不需要这么麻烦)。

另外,当我们希望把主控activity列在应用程序列表中时我们就给它添加 launcher category。

举个例子,一个产品管理程序,主控activity是先打开当前热销产品列表,它在手机的应用程序列表中,因此需要一个 launcher category,它有一个产品详细介绍的activity可以允许通过一个产品编号来查看产品,甚至在网页上有个链接,这时这个产品详细介绍activity就需要一个default category但不需要launcher category,而另一个修改产品资料的activity则不是必须添加一个category,因为它只会被主控activity启动并且外部其它app不应该有机会隐含地启动它。

http://developer.android.com/guide/components/intents-filters.html

‘柒’ 怎么获取android系统服务,如Uri,intent参数等,或者说去哪里查看

android系统服务,如Uri,intent参数
可以在Intent中指定程序要执行的动作(比如:view,edit,dial),以及程序执行到该动作时所需要的资料。都指定好后,只要调用startActivity(),Android系统会自动寻找最符合你指定要求的应用程序,并执行该程序。

★intent大全:

1.从google搜索内容

Intent intent = new Intent();

intent.setAction(Intent.ACTION_WEB_SEARCH);

intent.putExtra(SearchManager.QUERY,"searchString")

startActivity(intent);

2.浏览网页

Uri uri =Uri.parse("htt。。。。。。。。om");

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

3.显示地图

Uri uri = Uri.parse("geo:38.899533,-77.036476");

Intent it = newIntent(Intent.Action_VIEW,uri);

startActivity(it);

4.路径规划

Uri uri =Uri.parse("http。。。。。。。。。。/maps?
f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");

Intent it = newIntent(Intent.ACTION_VIEW,URI);

startActivity(it);

5.拨打电话

Uri uri =Uri.parse("tel:xxxxxx");

Intent it = new Intent(Intent.ACTION_DIAL,uri);

startActivity(it);

6.调用发短信的程序

Intent it = newIntent(Intent.ACTION_VIEW);

it.putExtra("sms_body", "TheSMS text");

it.setType("vnd.android-dir/mms-sms");

startActivity(it);

7.发送短信

Uri uri =Uri.parse("smsto:0800000123");

Intent it = newIntent(Intent.ACTION_SENDTO, uri);

it.putExtra("sms_body", "TheSMS text");

startActivity(it);

String body="this is sms demo";

Intent mmsintent = newIntent(Intent.ACTION_SENDTO, Uri.fromParts("smsto",
number, null));

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY,body);

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE,true);

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT,true);

startActivity(mmsintent);

8.发送彩信

Uri uri =Uri.parse("content://media/external/images/media/23");

Intent it = newIntent(Intent.ACTION_SEND);

it.putExtra("sms_body","some text");

it.putExtra(Intent.EXTRA_STREAM, uri);

it.setType("image/png");

startActivity(it);

StringBuilder sb = new StringBuilder();

sb.append("file://");

sb.append(fd.getAbsoluteFile());

Intent intent = newIntent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto",
number, null));

// Below extra datas are all optional.

intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT,subject);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY,body);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI,sb.toString());

intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE,composeMode);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT,exitOnSent);

startActivity(intent);

9.发送Email

Uri uri =Uri.parse("mailto:[email protected]");

Intent it = newIntent(Intent.ACTION_SENDTO, uri);

startActivity(it);

Intent it = new Intent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_EMAIL,"[email protected]");

it.putExtra(Intent.EXTRA_TEXT, "Theemail body text");

it.setType("text/plain");

startActivity(Intent.createChooser(it,"Choose Email Client"));

Intent it=new Intent(Intent.ACTION_SEND);

String[] tos={"[email protected]"};

String[]ccs={"[email protected]"};

it.putExtra(Intent.EXTRA_EMAIL, tos);

it.putExtra(Intent.EXTRA_CC, ccs);

it.putExtra(Intent.EXTRA_TEXT, "Theemail body text");

it.putExtra(Intent.EXTRA_SUBJECT, "Theemail subject text");

it.setType("message/rfc822");

startActivity(Intent.createChooser(it,"Choose Email Client"));

Intent it = newIntent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_SUBJECT, "Theemail subject text");

it.putExtra(Intent.EXTRA_STREAM,"file:///sdcard/mysong.mp3");

sendIntent.setType("audio/mp3");

startActivity(Intent.createChooser(it,"Choose Email Client"));

10.播放多媒体

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

11.uninstall apk

Uri uri =Uri.fromParts("package", strPackageName, null);

Intent it = newIntent(Intent.ACTION_DELETE, uri);

startActivity(it);

12.install apk

Uri installUri = Uri.fromParts("package","xxx", null);

returnIt = newIntent(Intent.ACTION_PACKAGE_ADDED, installUri);

打开照相机

<1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);

this.sendBroadcast(i);

<2>long dateTaken = System.currentTimeMillis();

String name = createName(dateTaken) + ".jpg";

fileName = folder + name;

ContentValues values = new ContentValues();

values.put(Images.Media.TITLE, fileName);

values.put("_data", fileName);

values.put(Images.Media.PICASA_ID, fileName);

values.put(Images.Media.DISPLAY_NAME, fileName);

values.put(Images.Media.DESCRIPTION, fileName);

values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);

Uri photoUri = getContentResolver().insert(

MediaStore.Images.Media.EXTERNAL_CONTENT_URI,values);

Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

inttPhoto.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);

startActivityForResult(inttPhoto, 10);

14.从gallery选取图片

Intent i = new Intent();

i.setType("image/*");

i.setAction(Intent.ACTION_GET_CONTENT);

startActivityForResult(i, 11);

打开录音机

Intent mi = new Intent(Media.RECORD_SOUND_ACTION);

startActivity(mi);

16.显示应用详细列表

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, findthe ID

//by clicking on your application on Markethome

//page, and notice the ID from the addressbar

刚才找app id未果,结果发现用package name也可以

Uri uri =Uri.parse("market://details?id=");

这个简单多了

17寻找应用

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 pathfor an application

18打开联系人列表

<1>

Intent i = new Intent();

i.setAction(Intent.ACTION_GET_CONTENT);

i.setType("vnd.android.cursor.item/phone");

startActivityForResult(i, REQUEST_TEXT);

<2>

Uri uri = Uri.parse("content://contacts/people");

Intent it = new Intent(Intent.ACTION_PICK, uri);

startActivityForResult(it, REQUEST_TEXT);

19 打开另一程序

Intent i = new Intent();

ComponentName cn = newComponentName("com.yellowbook.android2",

"com.yellowbook.android2.AndroidSearch");

i.setComponent(cn);

i.setAction("android.intent.action.MAIN");

startActivityForResult(i, RESULT_OK);

20.调用系统编辑添加联系人(高版本SDK有效):

Intent it = newIntent(Intent.ACTION_INSERT_OR_EDIT);

it.setType("vnd.android.cursor.item/contact");

//it.setType(Contacts.CONTENT_ITEM_TYPE);

it.putExtra("name","myName");

it.putExtra(android.provider.Contacts.Intents.Insert.COMPANY,
"organization");

it.putExtra(android.provider.Contacts.Intents.Insert.EMAIL,"email");

it.putExtra(android.provider.Contacts.Intents.Insert.PHONE,"homePhone");

it.putExtra(android.provider.Contacts.Intents.Insert.SECONDARY_PHONE,

"mobilePhone");

it.putExtra( android.provider.Contacts.Intents.Insert.TERTIARY_PHONE,

"workPhone");

it.putExtra(android.provider.Contacts.Intents.Insert.JOB_TITLE,"title");

startActivity(it);

21.调用系统编辑添加联系人(全有效):

Intent intent = newIntent(Intent.ACTION_INSERT_OR_EDIT);

intent.setType(People.CONTENT_ITEM_TYPE);

intent.putExtra(Contacts.Intents.Insert.NAME, "My Name");

intent.putExtra(Contacts.Intents.Insert.PHONE, "+1234567890");

intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,Contacts.PhonesColumns.TYPE_MOBILE);

intent.putExtra(Contacts.Intents.Insert.EMAIL, "[email protected]");

intent.putExtra(Contacts.Intents.Insert.EMAIL_TYPE,
Contacts.ContactMethodsColumns.TYPE_WORK);

startActivity(intent);

★intent action大全:

android.intent.action.ALL_APPS

android.intent.action.ANSWER

android.intent.action.ATTACH_DATA

android.intent.action.BUG_REPORT

android.intent.action.CALL

android.intent.action.CALL_BUTTON

android.intent.action.CHOOSER

android.intent.action.CREATE_LIVE_FOLDER

android.intent.action.CREATE_SHORTCUT

android.intent.action.DELETE

android.intent.action.DIAL

android.intent.action.EDIT

android.intent.action.GET_CONTENT

android.intent.action.INSERT

android.intent.action.INSERT_OR_EDIT

android.intent.action.MAIN

android.intent.action.MEDIA_SEARCH

android.intent.action.PICK

android.intent.action.PICK_ACTIVITY

android.intent.action.RINGTONE_PICKER

android.intent.action.RUN

android.intent.action.SEARCH

android.intent.action.SEARCH_LONG_PRESS

android.intent.action.SEND

android.intent.action.SENDTO

android.intent.action.SET_WALLPAPER

android.intent.action.SYNC

android.intent.action.SYSTEM_TUTORIAL

android.intent.action.VIEW

android.intent.action.VOICE_COMMAND

android.intent.action.WEB_SEARCH

android.net.wifi.PICK_WIFI_NETWORK

android.settings.AIRPLANE_MODE_SETTINGS

android.settings.APN_SETTINGS

android.settings.APPLICATION_DEVELOPMENT_SETTINGS

android.settings.APPLICATION_SETTINGS

android.settings.BLUETOOTH_SETTINGS

android.settings.DATA_ROAMING_SETTINGS

android.settings.DATE_SETTINGS

android.settings.DISPLAY_SETTINGS

android.settings.INPUT_METHOD_SETTINGS

android.settings.INTERNAL_STORAGE_SETTINGS

android.settings.LOCALE_SETTINGS

android.settings.LOCATION_SOURCE_SETTINGS

android.settings.MANAGE_APPLICATIONS_SETTINGS

android.settings.MEMORY_CARD_SETTINGS

android.settings.NETWORK_OPERATOR_SETTINGS

android.settings.QUICK_LAUNCH_SETTINGS

android.settings.SECURITY_SETTINGS

android.settings.SETTINGS

android.settings.SOUND_SETTINGS

android.settings.SYNC_SETTINGS

android.settings.USER_DICTIONARY_SETTINGS

android.settings.WIFI_IP_SETTINGS

android.settings.WIFI_SETTINGS

android.settings.WIRELESS_SETTINGS

‘捌’ android中intent的作用

意图和意图过滤器Intents and Intent Filters

一个应用程序的三个核心组件-活动,服务和广播接收器是通过消息即意图(Intents)来激活的。Intent息传送是相同或不同应用中组件运行时晚绑定的一种机制。意图本身,一个意图对象,是一个包含被执行操作抽象描述的被动的数据结构-或者,对于广播而言,是某件已经发生并被声明的事情的描述。存在不同的机制来传送意图到每种组件中:
• 一个意图对象是传递给Context.startActivity()或者Activity.startActivityForResult()来启动一个活动或者让一个存在的活动去做某些新的事情。
• 一个意图对象是传递给Context.startService()来发起一个服务或者递交新的指令给运行中的服务。类似的,一个意图能被传递给Context.bindService() 来在调用组件和一个目标服务之间建立连接。作为一个可选项,它可以发起这个服务如果还没运行的话。
• 传递给任意广播方法(例如Context.sendBroadcast(),Context.sendOrderedBroadcast(), 或者Context.sendStickyBroadcast())的意图对象被传递给所有感兴趣的广播接收者。许多种广播产生于系统代码。
在每个例子里,Android系统找到合适的活动,服务,或者一组广播接收者来回应这个意图,必要时实例化它们。这些消息传送系统没有重叠:广播意图仅被传递给广播接收者,永远不会给活动或者服务。一个传送给startActivity()的意图是只会被传递给一个活动,永远不会给一个服务或广播接收者,如此类推。
这篇文档以意图对象的描述开始,然后描述Android映射意图到组件的规则-如何解决哪个组件应该接收一个意图消息。对于没有显式命名一个目标组件的意图,这个过程包括对照与潜在目标相关联的意图过滤器来测试这个意图对象。

意图对象Intent Objects
一个意图Intent对象是一堆信息。它包含接收这个意图的组件感兴趣的信息(例如将要采取的动作和操作的数据)再加上Android系统感兴趣的信息(例如应该处理这个意图的组件类别和如何启动一个目标活动的指令):
组件名称Component name
应该处理这个意图的组件名字. 这个字段是一个ComponentName对象- 一个组合物:目标组件的完全合格的类名 (比如"com.example.project.app.FreneticActivity") 以及应用程序描述文件中设置的组件所在包的名字(比如, "com.example.project"). 这个组件名字的包部分和描述文件中设置的包名字不一定要匹配。
组件名字是可选的。如果被设置了,这个意图对象将被传递到指定的类。如果没有, Android使用另外的意图对象中的信息去定位一个合适的目标- 请看本文稍后描述的意图解析Intent Resolution。
组件名字通过如下方法:setComponent(),setClass(), 或者setClassName()设置并通过getComponent()读取。

‘玖’ android 里面intent类干什么的

intent即意图
一:用来启动其他新的Activity。
二:作为传递数据和事件的桥梁。传递数据时的代码有两种:
第一种是:
Intent
intent
=
new
Intent(CurrentActivity.this
,
OtherActivity.class);
intent.putExtra(“data”
,
somedata);
第二种是新建一个Bundle,再把该Bundle加入intent,如:
Bundle
bundle
=
new
Bundle()
;
bundle.putString(“data”
,
somedata)
;
intent.putExtras(bundle)。

热点内容
仿知乎android 发布:2024-05-08 01:56:00 浏览:902
mysql编译参数 发布:2024-05-08 01:53:46 浏览:191
怎么看台式电脑配置生产日期 发布:2024-05-08 01:32:26 浏览:458
java基础培训学校 发布:2024-05-08 01:30:44 浏览:465
简单辅助火眼打码如何配置 发布:2024-05-08 01:30:44 浏览:901
我的世界网易版服务器游戏 发布:2024-05-08 01:10:33 浏览:40
csgo中的存储库的功能 发布:2024-05-08 01:05:27 浏览:277
php旅游网站系统 发布:2024-05-07 20:27:32 浏览:611
jdk源码怎么看 发布:2024-05-07 20:18:22 浏览:520
编程c语言自学书 发布:2024-05-07 20:12:03 浏览:423