呼唤一个人的问题 [英] Problem in calling a person
问题描述
先生,我创建了一个连接到特定网站并调用特定人员等的应用程序,我已经成功生成了一个签名的.apk而没有任何错误,我的应用程序也在我的Android设备上运行但是它无法拨打一个特定号码。请帮我解决这个问题。
这就是我所做的:
我创建了一个致电按钮:
< 按钮
android:layout_width = wrap_content
android:layout_height = wrap_content
android:text = 给我打电话?
< span class =code-attribute> < span class =code-attribute> android:id = @ + id / button4
android:layout_below = @ + id / editText4
< span class =code-attribute>
android:layout_alignRight = @ + id / textView4
android:layout_alignEnd = @ + id / textView4 / >
添加了一个清单文件:
<? xml 版本 = 1.0 encoding = utf-8 ? >
< 清单 xmlns:android = http://schemas.android.com/apk/res/android
< span class =code-attribute> package = com.vis.vis >
< uses-permission android:name = android.permission.CALL_PHONE / >
< < span class =code-leadattribute> uses-permission android:name = android.permission.RE AD_PHONE_STATE / >
声明并定义要调用的按钮:
final 按钮调用=(按钮)findViewById(R.id.button4);
call.setOnClickListener( new View.OnClickListener(){
@ Override
public void onClick(查看v){
意图= new Intent(Intent.ACTION_CALL,Uri.parse( 1234567890));
< span class =code-keyword> try {
startActivity(in);
}
catch (android.content.ActivityNotFoundException ex){
Toast.makeText(getApplicationContext(), 再试一次!,Toast.LENGTH_SHORT)。show();
}
}
});
但它会用于捕获部分弹出再试一次!
我有没有错过了什么?
先生,请帮助我。
在你的按钮 onClick 中设置此代码:
Intent in = new Intent(Intent.ACTION_CALL);
in.setData(Uri.parse( tel:0123456789));
startActivity(in);
更改
意图in = new Intent( Intent.ACTION_CALL,Uri.parse( 1234567890));
到
意图in = new Intent(Intent.ACTION_CALL,Uri.parse( tel:1234567890));
-KR
Sir, I have created an application which connects to a specific website and calls a particular person etc., I have generated a signed ".apk" successfully without any errors and my application also runs on my android device but it fails to call a particular number. Kindly help me to solve this problem.
here is what I have done:
I have created a button for calling:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="call me?"
android:id="@+id/button4"
android:layout_below="@+id/editText4"
android:layout_alignRight="@+id/textView4"
android:layout_alignEnd="@+id/textView4" />
Added a manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vis.vis" >
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Declared and defined the button to call:
final Button call = (Button) findViewById(R.id.button4);
call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent in=new Intent(Intent.ACTION_CALL,Uri.parse("1234567890"));
try{
startActivity(in);
}
catch (android.content.ActivityNotFoundException ex){
Toast.makeText(getApplicationContext(),"Try again!",Toast.LENGTH_SHORT).show();
}
}
});
but it goes for catch part pop-upping "Try again!"
Have I missed anything?
Sir, Kindly help me with this.
In your button onClick set this code :
Intent in= new Intent(Intent.ACTION_CALL); in.setData(Uri.parse("tel:0123456789")); startActivity(in);
Change
Intent in=new Intent(Intent.ACTION_CALL,Uri.parse("1234567890"));
to
Intent in=new Intent(Intent.ACTION_CALL,Uri.parse("tel:1234567890"));
-KR
这篇关于呼唤一个人的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!