`
- 浏览:
680795 次
-
到打电话界面
-
uri=Uri.parse("tel:"+number);
-
intent=newIntent(Intent.ACTION_CALL,uri);
-
startActivity(intent);
到发送短信页面
-
uri=Uri.parse("smsto:"+要发送短信的对方的number);
-
intent=newIntent(Intent.ACTION_SENDTO,uri);
-
startActivity(intent);
另一种
-
mIntent=newIntent(Intent.ACTION_VIEW);
-
mIntent.putExtra("address",c.getString(c.getColumnIndex(column)));
-
mIntent.setType("vnd.android-dir/mms-sms");
-
startActivity(mIntent);
添加到短信收件箱
-
ContentValuescv=newContentValues();
-
cv.put("type","1");
-
cv.put("address","短信地址");
-
cv.put("body","短信内容");
-
getContentResolver().insert(Uri.parse("content://sms/inbox"),cv);
从sim卡或者联系人中查询
-
Cursorcursor;
-
Uriuri;
-
if(type==1){
-
Intentintent=newIntent();
-
intent.setData(Uri.parse("content://icc/adn"));
-
uri=intent.getData();
-
}else
-
uri=People.CONTENT_URI;
-
-
cursor=activity.getContentResolver().query(uri,null,null,null,null);
-
while(cursor.moveToNext()){
-
intpeopleId=cursor.getColumnIndex(People._ID);
-
intnameId=cursor.getColumnIndex(People.NAME);
-
intphoneId=cursor.getColumnIndex(People.NUMBER);}
删除
-
uri=ContentUris.withAppendedId(People.CONTENT_URI,联系人id);
-
intcount=activity.getContentResolver().delete(uri,null,null);
添加到联系人:
-
ContentValuescv=newContentValues();
-
ArrayList<ContentProviderOperation>operationList=newArrayList<ContentProviderOperation>();
-
ContentProviderOperation.Builderbuilder=ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);
-
builder.withValues(cv);
-
operationList.add(builder.build());
-
builder=ContentProviderOperation.newInsert(Data.CONTENT_URI);
-
builder.withValueBackReference(StructuredName.RAW_CONTACT_ID,0);
-
builder.withValue(Data.MIMETYPE,StructuredName.CONTENT_ITEM_TYPE);
-
builder.withValue(StructuredName.DISPLAY_NAME,"自定义联系人名");
-
operationList.add(builder.build());
-
builder=ContentProviderOperation.newInsert(Data.CONTENT_URI);
-
builder.withValueBackReference(Phone.RAW_CONTACT_ID,0);
-
builder.withValue(Data.MIMETYPE,Phone.CONTENT_ITEM_TYPE);
-
builder.withValue(Phone.NUMBER,"联系人的phonenumber");
-
builder.withValue(Data.IS_PRIMARY,1);
-
operationList.add(builder.build());
-
try{
-
getContentResolver().applyBatch(ContactsContract.AUTHORITY,operationList);
-
}catch(RemoteExceptione){
-
e.printStackTrace();
-
}catch(OperationApplicationExceptione){
-
e.printStackTrace();
-
}
动作 |
Uri |
说明 |
Intent.ACTION_VIEW
|
geo:latitude,longtitude
|
打开地图应用程序并显示指定的纬度和经度
|
Intent.ACTION_VIEW
|
geo:0,0?q=street+address
|
打开地图应用程序并显示指定的地址
|
Intent.ACTION_CALL
|
tel:phone_number
|
打开电话应用程序并拨打指定的电话号码
|
Intent.ACTION_DIAL
|
tel:phone_number
|
打开电话应用程序并拨下指定电话(但不打出)
|
Intent.ACTION_DIAL
|
voicemail:
|
打开电话应用程序并拨下语音信箱号码(但不打出)
|
Intent.ACTION_VIEW
|
http://web_address
|
打开浏览器应用程序并显示指定的URL
|
Intent.ACTION_VIEW
|
https://web_address
|
打开浏览器应用程序并显示指定的URL
|
Intent.ACTION_WEB_SEARCH
|
plain_text
|
打开浏览器应用程序并使用Google搜索引擎
|
发送邮件:
-
Uriuri=Uri.parse("mailto:terryyhl@gmail.com");
-
IntentMymailIntent=newIntent(Intent.ACTION_SEND,uri);
-
startActivity(MymailIntent);
方法二:
-
Intenttestintent=newIntent(Intent.ACTION_SEND);
-
String[]tos={"terryyhl@gmail.com"};
-
String[]ccs={"kalaicheng@hotmail.com"};
-
testintent.putExtra(Intent.EXTRA_EMAIL,tos);
-
testintent.putExtra(Intent.EXTRA_CC,ccs);
-
testintent.putExtra(Intent.EXTRA_TEXT,"这是内容");
-
testintent.putExtra(Intent.EXTRA_SUBJECT,"这是标题");
-
testintent.setType("message/rfc822");
-
startActivity(Intent.createChooser(testintent,"发送"));
播放多媒体:
-
-
Intentit=newIntent(Intent.ACTION_VIEW);
-
Uriuri=Uri.parse("file:///sdcard/song.mp3");it.setDataAndType(uri,"audio/mp3");
-
startActivity(it);
-
Uriuri=Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1");
-
Intentit=newIntent(Intent.ACTION_VIEW,uri);startActivity(it);
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
android常用Intent汇总,移动开发
Android 常用的Intent的URI及示例 很全很强大
Android Itent Action 小结
Android中Intent的常用方法一览.pdf 学习资料 复习资料 教学资源
主要介绍了Android常用的intent action功能与用法,分析了intent的原理以及action属性常用动作名称、作用与使用方法,需要的朋友可以参考下
跳转分析器是一个开发者小工具,用来分析Android应用程序之间跳转,例如常用的各种分享操作、或者是选择本机图片操作、利用第三方应用打开文件操作、从应用内跳转到应用市场等。附件为源码。
本文档记载了常用的几个系统组件的启动关键代码 action 和category data的值
主要介绍了android中intent传递list或者对象的方法,分析罗列了常用的几种方法,具有一定参考借鉴价值,需要的朋友可以参考下
intent的常用方法 Intent在Android中的几种用法 文章分类:综合技术
主要介绍了Android中Intent的使用方法,Android中的Intent是一个非常重要且常用的类,需要认真学习,感兴趣的小伙伴们可以参考一下
4种最常用的Intent传递方式,这4种方式如下: 1、通过Intent传递数据 2、通过静态变量传递数据 3、通过剪切板传递数据 4、通过全局变量传递数据
其实在系统的文件管理器中,这应该是我们常用的功能(包括文件的打开Intent.ACTION_VIEW)。 下面列出一个简单的分享方式 Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); ...
Android 常用Intent调用系统.打开网页,打开拨号,打开短信,发送短信获取发送和接收状态,卸载安装软件,打开应用,打开相机获取拍照图片,打开相册选取图片
Intent传递数据是android开发中最长用的数据传递方式,可是要传递对象不怎么常用,这里介绍第一种传递对象的方法Serializable传递
本文介绍Android中Intent的各种常见作用。 1 Intent.ACTION_MAIN String: android.intent.action.MAIN 标识Activity为一个程序的开始。比较常用。 Input:nothing Output:nothing <activity android:name=.Main ...
Android经典源码全集常用android小程序源码80个合集,可以做为你学习设计参考,每一个都是一个完整的小项目,里面都有源码,初学者学着用! 具体如下: GestureRecogniseSample GetPostSample ...
Bundle 翻译成中文的意思是“捆绑”,常用在Activity间传递参数,之前一开始并不太待见,原因是Intent本身就可以传递,Intent.putExtra(“key”, value),为何还要用Bundle呢? 正巧小伙伴问Android传值Intent和...
"Android实现图表绘制和展示","断点续传下载","常用Intent.Action","图片缩放圆角倒影Bitmap/Drawable转换", "SlidingDrawer抽屉效果","Android顶部与底部菜单","GroupActivity测试","Android平台水波效果源码",...