public class TinyDialer extends Activity
{
/** Called when the activity is first created. */
private Button button;
private EditText phonenumber;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main); button = (Button)findViewById(R.id.button_id);
phonenumber = (EditText)findViewById(R.id.phonenumber_id);
button.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String call = phonenumber.getText().toString();
if(PhoneNumberUtils.isGlobalPhoneNumber(call)){
Intent i = new Intent();
i.setAction(Intent.ACTION_CALL);
i.setData(Uri.parse(call));
startActivity(i);
}
else{
Toast.makeText(TinyDialer.this, R.string.correct_number, Toast.LENGTH_LONG).show();
}
}
});
这个程序是实现拨号的,程序本身没有错误,但是不能进行拨号功能,不知道还有什么地方有错误,帮忙帮我找出来下,
谢谢~~~
{
/** Called when the activity is first created. */
private Button button;
private EditText phonenumber;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main); button = (Button)findViewById(R.id.button_id);
phonenumber = (EditText)findViewById(R.id.phonenumber_id);
button.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String call = phonenumber.getText().toString();
if(PhoneNumberUtils.isGlobalPhoneNumber(call)){
Intent i = new Intent();
i.setAction(Intent.ACTION_CALL);
i.setData(Uri.parse(call));
startActivity(i);
}
else{
Toast.makeText(TinyDialer.this, R.string.correct_number, Toast.LENGTH_LONG).show();
}
}
});
这个程序是实现拨号的,程序本身没有错误,但是不能进行拨号功能,不知道还有什么地方有错误,帮忙帮我找出来下,
谢谢~~~
解决方案 »
- android 使用ksoap调用webservice为什么参数必须按顺序?
- repo 获取android源代码
- canvas 画文本时如何控制文本颜色
- android MediaPlayer 获取MP3 播放时长问题
- 【新手学习】activity跳转后 run()遗留问题
- 谁知道安卓浮窗里的文字怎么改变啊?浮窗时钟原理
- 如何侦测自己的APP被退到背景去?
- android程序设计配置化问题
- android 手机之间(机顶盒之间) 应用的交互(服务)
- 刚学习android, 想做个计算器,很简单的xml部局,也达不到效果.有图,请高手来指点下!
- viewgroup 子view刷新失效?
- rtsp android客户端采购
i.setData(Uri.parse(call));;parse(tel"://"+call)书上是这么写的。。不知道哪个对,也是初学。。
call应当要权限的,你设置了吗?
好像是这样写吧:
i.setData(Uri.parse("tel://"+call));