Intend之Date的几个功能

封装为一个方法

1.跳转到拨号页面

1 //跳转到拨号页面的方法
2     protected void takeCall(String info){
3         Intent intent=new Intent();
4         intent.setData(Uri.parse("tel://"+info));
5         intent.setAction(Intent.ACTION_DIAL);
6         startActivity(intent);
7     }

此时参数info即为传入的号码,点击按钮(在此按钮的监听器中添加takeCall方法),就可到拨号页面

2.跳转到网页界面

1 //跳转网页的方法
2     protected void takeCall(String info){
3         Intent intent=new Intent();
4         intent.setData(Uri.parse("http://"+info));
5         intent.setAction(Intent.ACTION_VIEW);
6         startActivity(intent);
7     }

3.跳转到信息界面

1 //跳转信息页面的方法
2     protected void takeCall(String info){
3         Intent intent=new Intent();
4         intent.setData(Uri.parse("smsto:"+info));
5         intent.setAction(Intent.ACTION_SENDTO);
6         startActivity(intent);
7     }

 

posted @ 2020-02-24 16:01  东功  阅读(190)  评论(0编辑  收藏  举报