zoukankan      html  css  js  c++  java
  • Android打电话&发短信

    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.main);  
        mobileEditText = (EditText) this.findViewById(R.id.app_name);  
        mobileButton = (Button) this.findViewById(R.id.button);  
        mobileButton.setOnClickListener(new View.OnClickListener() {  
              
            @Override 
                public void onClick(View v) {  
                // TODO Auto-generated method stub  
                String mobile = mobileEditText.getText().toString();  
                Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+mobile));  
                androidTest2Activity.this.startActivity(intent);  
            }  
        });  
    }  
    --------------------------------------------------------------------------------------  
     
    public void onClick(View v) {  
        // TODO Auto-generated method stub  
        String mobile = mobileText.getText().toString();  
        String content = contentText.getText().toString();  
        SmsManager smsManager = SmsManager.getDefault();  
        if(content.length()>70){  
            List<String> contents=smsManager.divideMessage(content);  
            for(String sms:contents){  
                smsManager.sendTextMessage(mobile, null, sms, null, null);  
            }  
        }  
        else{  
            smsManager.sendTextMessage(mobile, null, content, null, null);  
        }  
        Toast.makeText(SMSActivity.this, "发送成功", 2).show();  
    }   
     
     
     
    
    //本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/702527
  • 相关阅读:
    手把手教你在Android手机上实现蓝牙键盘的支持
    python 字符编码
    vi常用命令
    EditPlus for python
    Eclipse安装pydev插件
    手把手教你在Android手机上实现蓝牙键盘的支持
    2020年7月23日
    2020年7月20日
    2020年7月18日
    2020年7月22日
  • 原文地址:https://www.cnblogs.com/umgsai/p/3908247.html
Copyright © 2011-2022 走看看