title: How can I add a button that makes a phone call to a programmatically given phone number?
body: <p>I have an app, that shows a list of friends (each friend haves fullName and movilephone).</p>
  
  <p>I'm using a variation of the listActiviti example of android developers guide</p>
  
  <p>can someone complete my code or tell me code examples of how to put a button on the right side of the items of each list, that when the user press on that button, the phone calls to the phone number of that user. Also, now, when the user press on the list item (but not on the button) it's opened a new activity for showing details of the friend... this functionality haves to be working separatedly of the button</p>
  
  <p>this is my <code>list_item.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="10dp"
      android:textSize="16sp" &gt;
  &lt;/TextView&gt;
  </code></pre>
  
  <p>and this is my code for the listActivity:</p>
  
  <pre><code>public class AllActivity extends ListActivity {
  
  RemoteConnection con; //conexion remota 
  private List&lt;Friend&gt; friends; //lista de amigos
  private List&lt;String&gt; usernames; //lista de usernames de amigos, para rellenar el listview
  static SharedPreferences settings;
  static SharedPreferences.Editor configEditor;
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);        
      settings=PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
      configEditor = settings.edit();
      friends = new ArrayList&lt;Friend&gt;();
      usernames = new ArrayList&lt;String&gt;();
      con = new RemoteConnection();
      actualizar();
  
  }
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == 1) {
          setResult(1);
          finish();                   
      }
  }
  public void onResume() {
      super.onResume();       
     }   
      public void actualizar()
      {
          friends = MyApplication.getDatabaseAdapter().retrieveAllFriends();
          usernames.clear();
  
  
  for (int i=0;i&lt;friends.size();i++)
          {
              usernames.add(i,friends.get(i).getFullName());
          }
          setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, usernames));
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);
          lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                int position, long id) {
  
  
                Bundle bundle = new Bundle(); //bundle is like the letter           
                bundle.putString ("user", friends.get(position).getFullName()); //arg1 is the keyword of the txt, arg2 is the txt
                bundle.putString ("email", friends.get(position).getEmail());
                bundle.putString ("permission", friends.get(position).getPermission());
  
                Intent i=null;
                if (friends.get(position).getPermission().equals("total"))
                    i = new Intent (AllActivity.this, Locate.class);
                else if (friends.get(position).getPermission().equals("perhours"))
                    i = new Intent (AllActivity.this, LocatePerHours.class);
                else
                    i = new Intent (AllActivity.this, LocatePerDays.class);
  
                i.putExtras(bundle);
                startActivity(i);
            }
          });
      }
  }
  </code></pre>