调用系统设备的代码

调用系统拨号

Intent intent = new Intent();

intent.setAction("android.intent.action.CALL_BUTTON");

startActivity(intent);

调用系统的发短信功能:

Uri smsToUri = Uri.parse("smsto:");

Intent mIntent = new Intent( android.content.Intent.ACTION_SENDTO, smsToUri );

mIntent.putExtra("sms_body", "");

startActivity( mIntent );

调用系统的相机功能:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

startActivity(intent);

权限<uses-permission android:name="android.permission.CAMERA"/>

调用系统相册

Intent intent=new Intent(Intent.ACTION_GET_CONTENT);

intent.addCategory(Intent.CATEGORY_OPENABLE);

intent.setType("image/*");

intent.putExtra("return-data", true);

startActivityForResult(intent, 0);

调用音乐播放器

Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");

startActivity(intent);

调用本机的视频播放器

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setType("video/*");

startActivity(intent);

调用系统的计算器

Intent mIntent = new Intent();

mIntent.setClassName("com.android.calculator2","com.android.calculator2.Calculator");

startActivity(mIntent);

加权限<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />

调用系统录像机

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0.9);

startActivity(intent);

录音机

Intent intent=new Intent(Media.RECORD_SOUND_ACTION);

startActivity(intent);

调用闹钟

Intent alarmas = new Intent(AlarmClock.ACTION_SET_ALARM);

startActivity(alarmas);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值