title: How can I call a number from button press in Android?
body: <p>I'm very much a beginner at this and I'm struggling to get this to work. </p>
  
  <p>When button is pressed, I simply want the dialer to open with the specified number automatically inputted.</p>
  
  <p>So far I've tried the following:</p>
  
  <pre><code>Button btn_call_us = (Button) findViewById(R.id.btn_call_us);
         btn_call_us.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  Intent callIntent = new Intent(Intent.ACTION_CALL);
                  callIntent.setData(Uri.parse("tel:00000000"));
                  startActivity(callIntent);
  
              }
          });
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>Button btn_call_us = (Button) findViewById(R.id.btn_call_us);
          btn_call_us.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  String phoneno="00000000";
  
                  Intent i=new Intent(Intent.ACTION_CALL,Uri.parse(phoneno));
                  startActivity(i);
  
              }
          });
  </code></pre>
  
  <p>I've added the permission ACTION_CALL to the manifest.</p>
  
  <p>Whenever I click the Call button the app force closes. </p>
  
  <p>Any assistance would be greatly appreciated. </p>
  
  <p>Thank you!</p>