package com.example.firstproject;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
private EditText et_phoneNum;
private Button btn_call;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_phoneNum = (EditText) findViewById(R.id.phoneNum);
btn_call = (Button) findViewById(R.id.btn_call);
btn_call.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String mobile = et_phoneNum.getText().toString();
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+mobile));
MainActivity.this.startActivity(intent);
}
});
}
}
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
private EditText et_phoneNum;
private Button btn_call;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_phoneNum = (EditText) findViewById(R.id.phoneNum);
btn_call = (Button) findViewById(R.id.btn_call);
btn_call.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String mobile = et_phoneNum.getText().toString();
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+mobile));
MainActivity.this.startActivity(intent);
}
});
}
}