[英]android dialer to a fixed number
I'm trying to make an android project that will dial a fixed number. 我正在尝试制作一个将拨打固定号码的android项目。 It is working when I'm using normal number like 01712364445 or something like that.
当我使用01712364445之类的普通数字时,它可以工作。 But when I'm using this number *566# it is dialing to *567 that is # is missing.how to solve this ?
但是当我使用此号码* 566#时,它正在拨打* 567,而#丢失了。如何解决此问题? My code is here...
我的代码在这里...
gp = (Button) findViewById(R.id.buttongp);
gp.setOnClickListener(listener);
}
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent dialerIntent = new Intent();
dialerIntent.setAction(Intent.ACTION_CALL);
dialerIntent.setData(Uri.parse("tel:*566# "));
startActivity(dialerIntent);
}
};
Intent callIntent = new Intent(Intent.ACTION_CALL);
string pnd=uri.encode("#"); callIntent.setData(Uri.parse("tel:566 "+pnd)); startActivity(callIntent);
Try this 尝试这个
And make the constructor global before the main function 并使构造函数在主要功能之前变为全局
Edit: This code works 编辑:此代码有效
Button b; Intent callIntent = new Intent(Intent.ACTION_CALL); String pnd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
b=(Button)findViewById(R.id.b1);
OnClickListener ls=new OnClickListener(){
@Override
public void onClick(View p1)
{
{
pnd=Uri.encode("#");
callIntent.setData(Uri.parse("tel:*566 "+pnd));
startActivity(callIntent);
}
// TODO: Implement this method
}
};
b.setOnClickListener(ls);
}
} }
And the uri.encode(" #"); 还有uri.encode(“#”); puts the pound sign in there retrieving ussd code.
将英镑符号放在其中以获取美元代码。 Follow procedures and concatenate the uri.encode("#");
遵循步骤并连接uri.encode(“#”);
Tested and works 经过测试和工作
Tested using AIDE for Android. 使用Android的AIDE测试。 It's how I create my apps from my smartphone.
这就是我从智能手机创建应用程序的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.