Note that there are some explanatory texts on larger screens.

plurals
  1. POI'm trying to make a simple app that gives you the option to make a phone call
    primarykey
    data
    text
    <p>My droid app has a button on the main page that gives you an dialogue popup page and asks within the dialogue page whether you want to make a phone call or not</p> <p>Ive tried and over and over and haven't quite figured out how to get the button to make a phone call</p> <p>My opening java page package your.package2.phonecalls;</p> <pre><code>import android.app.Activity; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class ButtonphonecallsActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button TheCallButton = (Button) findViewById(R.id.phonecallbutton); TheCallButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Dialog dialog = new Dialog(ButtonphonecallsActivity.this); dialog.setContentView(R.layout.alertphonecall); dialog.setTitle("Zohan contact number"); Button Nosir = (Button) dialog.findViewById(R.id.nobutton); Nosir.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.cancel(); } }); Button Yessir = (Button) dialog.findViewById(R.id.yesbutton); Yessir.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.cancel(); startActivity(new Intent(ButtonphonecallsActivity.this, makingaphonecall.class)); } }); dialog.show(); } }); } } </code></pre> <p>The phone call activity</p> <pre><code>package your.package2.phonecalls; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; public class makingaphonecall extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); call(); } private void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:7578263678")); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("helloandroid dialing example", "Call failed"); } } } </code></pre> <p>android manifest</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package2.phonecalls" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;uses-permission android:name="android.permission.CALL_PHONE"/&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:debuggable="true" &gt; &lt;activity android:name=".ButtonphonecallsActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".makeaphonecall" android:label="@string/app_name" &gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload