Creating an Example Application to Run the call Method

Write App Reviews

Build your own Android App Dev Empire

Get Instant Access

To test the method in Example 14-1, create a new Android project in Eclipse by selecting File ^ New ^ Project ^ Other When the "Select a Wizard" dialog appears, select Android ^ Android Project. When you see the new project dialog, fill it in as shown in Figure 14-1.

Press Finish to create a project named dialing-example in your Eclipse workspace. (The complete code for this example is also on the book's website.) You will see this project in the Package Explorer pane of your Eclipse IDE. Expand the project to see a set of folders, including one named src. Expand this folder to see a package named example.dialing. Expand that package and you will see two Java source files, one of which is named This file contains the code in Example 14-2.

Example 14-2. Setting up an application to make phone calls package example.dialing;


import android.content.ActivityNotFoundException; import android.content.Intent; import; import android.os.Bundle; import android.util.Log;

public class dialing extends Activity {

/** Called when the activity is first created. */ ^Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

This is where you will put the code that invokes our call method.

Figure 14-1. Creating a phone project in Eclipse

Was this article helpful?

0 0

Post a comment