Android 拨号界面和直接拨打电话界面代码控制

//定义TAG为空

private static final String TAG = null;

//定义Button的点击事件

tell.setOnClickListener(new View.OnClickListener() {
  
  @Override
  public void onClick(View v) {
   // TODO Auto-generated method stub
 /*  Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+10086));
   
   startActivity(intent);*/
   
   
    //直接拨打 
   
   String tel = "10086";
         call(tel);
  }
 });

//点击事件调用的类

protected void call(String tel) { 
  /*      // 只进入拨号界面,不拨打 
         Uri uri = Uri.parse("tel:" + tel); 
         Intent intent = new Intent(Intent.ACTION_DIAL, uri); 
         startActivity(intent);  */
 
         //直接拨打 
        Log.d(TAG, "call:" + tel); 
        Uri uri = Uri.parse("tel:" + tel); 
        Intent intent = new Intent(Intent.ACTION_CALL, uri); 
        startActivity(intent); 
    }

注意: 添加权限:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />   
<uses-permission android:name="android.permission.CALL_PHONE" />   
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>

Android 直接拨打电话界面的更多相关文章

  1. Android手机拨打电话的开发实例

    一部手机最常用的功能就是打电话和发短信了,在Android开发中我们如何通过程序拨打电话呢?本文就给出一个用Android手机拨打电话的简单的实例. 下面是开发此实例的具体步骤: 一.新建一个Andr ...

  2. android 自动拨打电话 挂断电话代码

    页面布局文件代码  (  res下面的layout下面的activity_main.xml代码 ) <RelativeLayout xmlns:android="http://sche ...

  3. 脚本控制向Android模拟拨打电话,发送短信,定位设置功能

    做行为触发的时候要向模拟器实现拨打电话,发送短信,定位设置的的功能,可以很方便通过telnet localhost  5554实现. 写个脚本很快的搞定了.网上资料很多,脚本的很少,也所积点德啦. 写 ...

  4. ios app跳转拨打电话界面,调用拨打电话功能

    DNLogFUNC //两种方法都可以用 //这种据说是可以上appstore NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithF ...

  5. Android 学习第11课,android 实现拨打电话的功能

    1. 先布局界面,界面采用线性垂直方式来布局 在layout 界面文件中 activity_main.xml 中 <LinearLayout xmlns:android="http:/ ...

  6. Android 打开URL中的网页和拨打电话、发送短信功能

    拨打电话需要的权限 <uses-permission android:name="android.permission.CALL_PHONE"/> 为了省事界面都写一起 ...

  7. Android APP代码拨打电话、打开手机分享功能等隐式意图

    Android APP拨打电话: Intent intent=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+110)); start ...

  8. Android中使用Intent的Action和Data属性实现点击按钮跳转到拨打电话和发送短信

    场景 点击拨打电话按钮,跳转到拨打电话页面 点击发送短信按钮,跳转到发送短信页面 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程 ...

  9. Android学习3—电话拨号器

    本测试主要实现了一个Android的拨打电话的功能 一:界面预览 由图中可以看出,这个Activity需要3个控件:TextView.EditText.Button 其实实现一个功能要经过几个步骤: ...

随机推荐

  1. uva140 - Bandwidth

    Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an orderi ...

  2. javascript 操作 excel 全攻略

    最近做一个项目,用到了javascript操纵excel以生成报表,下面是标有详细注解的实例 <html> <head><script language="ja ...

  3. ActivityGroup+LinearLayout实现iphone风格的底部tab菜单

    public class ActsGroup extends ActivityGroup {       private LinearLayout bodyView;     private Line ...

  4. Center OS mongodb安装

    一.下载        1.#cd /usr/local/src     2.#wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2. ...

  5. PHP手册总结《预定义变量》

    一:$_GET GET 是通过 urldecode() 传递的. 二:$_SERVER 这个数组中的项目由 Web 服务器创建.不能保证每个服务器都提供全部项目:服务器可能会忽略一些 三:$argc, ...

  6. The Kernel Newbie Corner: Kernel Debugging with proc "Sequence" Files--Part 2

    转载:https://www.linux.com/learn/linux-career-center/39972-kernel-debugging-with-proc-qsequenceq-files ...

  7. MAMP Pro3.5注册码

    MAMP这个就不用介绍了,堪称MAC下的苏菲玛索,官方下载地址:https://www.mamp.info/en/mamp-pro/   ,400多大洋,土豪朋友请直接购买吧,正版还是要支持的. 和我 ...

  8. Mac上安装Tomcat服务器

    1.下载Tomcat安装包,下载地址:http://tomcat.apache.org/ 选择你想要的版本,在这里我选择下载Tomcat 8 ps:你也可以使用axel多线程下载命令下载 下载的速度很 ...

  9. Android动画主要包含补间动画(Tween)View Animation、帧动画(Frame)Drawable Animation、以及属性动画Property Animation

    程序运行效果图: Android动画主要包含补间动画(Tween)View Animation.帧动画(Frame)Drawable Animation.以及属性动画Property Animatio ...

  10. UIWebView获得内容的高 高度自适应 宽度自适应

    UIWebView获得内容的高-作出自适应高的UIWebView- (void)webViewDidFinishLoad:(UIWebView *)webView { NSString *height ...