Intent.使用小结
来源:互联网 发布:淘宝二手手机评估 编辑:程序博客网 时间:2024/05/21 22:24
打电话
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(“tel:12345678”));
startActivity(callIntent);
权限拒绝后就不能再拨打电话了,6.0后可以加一个权限管理对于这种危险权限
通过一个url跳转到一个网页
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button)findViewById(R.id.button1); button.setOnClickListener(new MyListener()); final Uri uri = Uri.parse("http://weibo.cn/qlyh"); intent = new Intent(Intent.ACTION_VIEW, uri); timer = new Timer(); } class MyTimerTask extends TimerTask { @Override public void run() { startActivity(intent); } } class MyListener implements OnClickListener { public void onClick(View v) { if(task != null) task.cancel(); task = new MyTimerTask(); timer.schedule(task, 1000); } }
使用Intent在onReceive中跳转
package com.jack.buttonkeytest;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;public class MyReceiver extends BroadcastReceiver{ @Override public void onReceive( Context context, Intent intent) { final Context c = context; new Thread(){ @Override public void run() { super.run(); Intent intent = new Intent(c, ShowActivity.class); c.startActivity(intent); } }.start(); }}
推荐阅读:
Intent或持久化存储处理复杂对象
阅读全文
0 0
- Intent使用小结
- Intent.使用小结
- Intent小结
- Intent小结
- intent小结
- Intent 小结
- android之Intent小结
- intent小结2
- intent小结03
- Intent重点小结
- 【Android归纳】intent小结
- intent知识小结
- Android Intent 小结
- Intent(显示使用intent)
- intent 使用
- Intent 使用
- Intent 使用
- Intent使用
- 面试题32问
- OkHttp Source Code Analyse (Part one)
- 海量数据处理
- webstorm 提示 Can't use Subversion command line client: svn
- C/C++ 第八周串和数组 (一)建立顺序串的算法库 项目1
- Intent.使用小结
- java分布式电子商务云平台b2b b2c o2o需要准备哪些技术??
- 我们为什么要造自动驾驶汽车?它到底有什么用?
- 构建linux根文件系统(六)终结
- ActiveMQ消息传送机制以及ACK机制详解
- 第二周项目二
- 新词话 | 空间计算
- 洞见 | 智能引领数字经济 2017 ICT企业家大会带您与产业领袖同行未来!
- 第二周-项目三-排序算法的运行时间