Issue
I would like to schedule a phone call on an android application.
I currently have an onClick event for a button to make a phone call, I also have time and date picker and would like to be able to use them to schedule a time to make the call.
Any help would be appreciated.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter MSISDN Below" android:textAppearance="?android:attr/textAppearanceLarge"/>
<EditText android:id="@+id/msisdn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:ems="10" android:inputType="phone">
<requestFocus />
</EditText>
<TextView android:id="@+id/textView2" android:layout_width="344dp" android:layout_height="wrap_content" android:text="Enter Schedule Time Below" android:textAppearance="?android:attr/textAppearanceLarge"/>
<TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Set Call" android:onClick="makeCall"/>
</LinearLayout>
******** Class *************************
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
public class CallAppActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void makeCall(View view) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel: 123456789"));
startActivity(callIntent);
}
}
Solution
Don't worry I figured it out. In case anyone is interested, I used a Handler to delay the intent action call.
Answered By - Parksie