Android Activity 和 Intent 机制学习笔记
2010-03-18 00:16:00 来源:WEB开发网核心提示:打电话1. //叫出拨号程序2. Uri uri = Uri.parse("tel:0800000123");3. Intent it = new Intent(Intent.ACTION_DIAL, uri);4. startActivity(it);1. //直接打电话出去2. Uri uri
打电话
1. //叫出拨号程序
2. Uri uri = Uri.parse("tel:0800000123");
3. Intent it = new Intent(Intent.ACTION_DIAL, uri);
4. startActivity(it);
1. //直接打电话出去
2. Uri uri = Uri.parse("tel:0800000123");
3. Intent it = new Intent(Intent.ACTION_CALL, uri);
4. startActivity(it);
5. //用呃?,要在 AndroidManifest.xml 中,加上
6. //《uses-permission id="android.permission.CALL_PHONE" /》
传送SMS/MMS
1. //调用短信程序
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. it.putExtra("sms_body", "The SMS text");
4. it.setType("vnd.android-dir/mms-sms");
5. startActivity(it);
1. //传送消息
2. Uri uri = Uri.parse("smsto://0800000123");
3. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
4. it.putExtra("sms_body", "The SMS text");
5. startActivity(it);
1. //传送 MMS
更多精彩
赞助商链接