I'm new to android development and trying to make an app with 2 buttons, one calls a specific number and the other just answers the phone when being called. Except I don't really know what to define in the ACTION_ANSWER area.. Thanks in advance!
My MainActivity.java
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends ActionBarActivity {
private Button button1;
private Button button2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1 = (Button) findViewById(R.id.buttonCall);
button1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:0634834906"));
startActivity(callIntent);
}
});
button2 = (Button) findViewById(R.id.buttonAnswer);
button2.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent answerIntent = new Intent(Intent.ACTION_ANSWER);
}
});
}
}