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:
="1.0"="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.