Android004_在跳出的页面上实现打电话和发短信的功能
来源:互联网 发布:java企业级开发 编辑:程序博客网 时间:2024/05/17 20:08
让跳出打电话和发短信字样的窗口:然后实现打电话和发短信功能:
网友的:
public class Android3G1_01Activity extends Activity {
/** Called when the activity is first created. */
private Button bt=null;
private EditText tv=null;
//private String action="android.intent.action.CALL";
//private String type="tel";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt=(Button) findViewById(R.id.bt);
tv=(EditText) findViewById(R.id.edt);
bt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String mobileNum=tv.getText().toString();
Intent intent=
new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+mobileNum));
startActivity(intent);
/**
*原创的思想给了我的主要的思考方向
*但是call在我的代码中没有用,会报错,但是DIAL有用
* @author YJBo
*/
}
});
}
我的:
new AlertDialog.Builder(this).setMessage("欢迎使用NB软件")
.setPositiveButton("发短信", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// boolean callOnClick = tv_phone.callOnClick();
// dialog.notify();
// dialog = (DialogInterface) tv_phone;
// boolean click = tv_phone.callOnClick();
/*
* (non-Javadoc) 那个“按钮事件连接到实际的打电话中还是不能的,自己想不懂应该怎么弄
*/
try {
// 我之前用的是ACTION_CALL,但是不行,得用ACTION_DIAL
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"
+ _phone.getText().toString()));
startActivity(intent);
Toast.makeText(MainActivity.this,"点我啊.......!"
+ tv_phone.getText().toString(),
Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}).setNegativeButton("打电话", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
// 我之前用的是ACTION_CALL,但是不行,得用ACTION_DIAL
Intent intent = new Intent(Intent.ACTION_DIAL, Uri
.parse("tel:" + tv_phone.getText().toString()));
startActivity(intent);
Toast.makeText(MainActivity.this,"点我啊.......!"
+ tv_phone.getText().toString(),
Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}).create().show();
//解析的时候,一定要与之对应:短信:smsto ;电话:tel;
//意图时:短信:Intent.ACTION_SENDTO ;电话:Intent.ACTION_DIAL
//主要就是注意这俩段代码:
1).Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"
+ _phone.getText().toString()));
startActivity(intent);
2).Intent intent = new Intent(Intent.ACTION_DIAL, Uri
.parse("tel:" + tv_phone.getText().toString()));
startActivity(intent);
- Android004_在跳出的页面上实现打电话和发短信的功能
- iOS 打电话 发短信功能的简单实现
- Android调用系统的打电话和发短信功能
- Android的打电话发短信功能实例
- ios 调用打电话,发短信的功能
- android实现打电话和发短信的功能(10学员张晓丛)
- 【Android】打电话与发短信的实现
- 在页面中打电话、发短信
- android实现打电话 发短信功能
- Android 调用打电话和发短信功能
- iOS 开发中常用的小功能(打电话,发短信...)
- 如何调用windows mobile的打电话、发短信页面
- Android 实现打电话和发短信
- Android实现打电话和发短信
- webapp开发之打电话、发短信、发邮件功能实现
- 打电话和发短信
- 打电话和发短信
- 打电话和发短信
- MySQL的数据类型
- ASP.NET-log4net使用简介
- OpenCV-前景提取
- C#开源控件大全
- SikuliX 1.1.0 Beta从安装到测试框架(2)
- Android004_在跳出的页面上实现打电话和发短信的功能
- 经纬财富:武汉白银投资市场热潮席卷,怎么投资现货白银?
- v4l2应用
- jquery入门 修改网页背景颜色
- LOG4J性能优化
- Java言语入门教程Java类的组成
- AEC、AGC、ANS 作用
- 深入浅出linux内核源代码之双向链表list_head(上)
- 苹果编程语言Swift解析:将推动应用开发巨变