private static final String MyTag = "CallActivity";
private EditText etPhoneNumber;
@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_call);
etPhoneNumber = (EditText) this.findViewById (R.id.et_phonenumber);
final Button btnCall = (Button) this.findViewById (R.id.bt_call);
btnCall.setOnClickListener (new View.OnClickListener () {
@ Override
public void onClick (View v) {
String tempNo = etPhoneNumber.getText () toString ();.
Intent myIntent = new Intent (CallActivity.this, CallActivity.class);
myIntent.setAction (Intent.ACTION_DIAL);
myIntent.setData (Uri.parse ("tel:" + tempNo));
startActivity (myIntent);
}
});
}
android: minSdkVersion = "8"
android: targetSdkVersion = "18" />android: allowBackup = "true"
android: icon = "@ drawable / ic_launcher"
android: label = "@ string / app_name"
android: theme = "@ style / AppTheme">android: name = "com.ecarechina.phonecall.CallActivity"
android: label = "@ string / app_name">
Click the button, the form has a flashing back to Activity on the
My simulator which did not bring the phone system that icon.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Do not call the system a program??
Reply:
Just upload a look at the real machine does not work ... it seems the program in question
Reply:
Intent.ACTION_DIAL into Intent.ACTION_CALL.
Reply:
Intent.ACTION_CALL tried not
Reply:
public void onClick (View v) {
String tempNo = etPhoneNumber.getText () toString ();.
Intent myIntent = new Intent (Intent.ACTION_CALL,
Uri.parse ("tel :/ /" + tempNo));
startActivity (myIntent);
} onClick so write, you write that it is wrong.
Reply:
Your simulator there are no phone this application? Anything can be called up, of course, is if you do not look no flash
Reply:
I am using an anonymous inner class to write, if you do not specify that the two parameters can not run
Reply:
Loaded into the real machine does not work.
Reply:
You can run, you change it according to know. I have already been verified.
Reply:
Thank you upstairs
But it is strange
Intent myIntent = new Intent ();
myIntent.setAction (Intent.ACTION_DIAL);
myIntent.setData (Uri.parse ("tel:" + tempNo));
I used this way before, but I could not.
Reply:
Sigh, just tried it OK. . .
No comments:
Post a Comment