List of usage examples for android.content Intent ACTION_CALL
String ACTION_CALL
To view the source code for android.content Intent ACTION_CALL.
Click Source Link
From source file:com.example.android.testing.espresso.BasicSample.DialerActivity.java
private Intent createCallIntentFromNumber() { final Intent intentToCall = new Intent(Intent.ACTION_CALL); String number = mCallerNumber.getText().toString(); intentToCall.setData(Uri.parse("tel:" + number)); return intentToCall; }
From source file:com.bordengrammar.bordengrammarapp.ParentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_parents, container, false); mail = (LinearLayout) root.findViewById(R.id.linmail); call = (LinearLayout) root.findViewById(R.id.lincall); call.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j a v a2s . c om public void onClick(View arg0) { Intent cally = new Intent(Intent.ACTION_CALL); cally.setData(Uri.parse("tel:01795424192")); startActivity(cally); } }); mail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle("Send a email to Borden Grammar"); alert.setMessage("Message: "); final EditText input = new EditText(getActivity()); alert.setView(input); alert.setPositiveButton("Send", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); // Do something with value! Intent email = new Intent(Intent.ACTION_SEND); email.setType("plain/text"); email.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "school@bordengrammar.kent.sch.uk" }); email.putExtra(Intent.EXTRA_SUBJECT, "Email (Sent From BGS APP) "); email.putExtra(Intent.EXTRA_TEXT, value); startActivity(Intent.createChooser(email, "Choose an Email client :")); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); } }); URL url = null; try { url = new URL( "http://website.bordengrammar.kent.sch.uk/index.php?option=com_rubberdoc&view=category&id=63%3Aletters&Itemid=241&format=feed&type=rss"); } catch (MalformedURLException e) { e.printStackTrace(); } Feed feed = null; try { feed = FeedParser.parse(url); } catch (FeedIOException e) { e.printStackTrace(); } catch (FeedXMLParseException e) { e.printStackTrace(); } catch (UnsupportedFeedException e) { e.printStackTrace(); } Boolean nully = false; for (int i = 0; i < 3; i++) { try { FeedItem item = feed.getItem(i); } catch (NullPointerException e) { e.printStackTrace(); nully = true; Toast.makeText(getActivity().getApplicationContext(), "Some features of this app require a internet connection", Toast.LENGTH_LONG).show(); } } if (!nully) { final FeedItem post1 = feed.getItem(1); final FeedItem post2 = feed.getItem(2); final FeedItem post3 = feed.getItem(3); TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText(post1.getTitle()); title2.setText(post2.getTitle()); title3.setText(post3.getTitle()); TextView link1 = (TextView) root.findViewById(R.id.link1); TextView link2 = (TextView) root.findViewById(R.id.link2); TextView link3 = (TextView) root.findViewById(R.id.link3); link1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post1.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post2.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post3.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); } else { TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText("No connection"); title2.setText("No connection"); title3.setText("No connection"); } TextView reader = (TextView) root.findViewById(R.id.reader); reader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String appPackageName = "com.adobe.reader"; // getPackageName() from Context or Activity object try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } } }); return root; }
From source file:com.mobileglobe.android.customdialer.common.CallUtil.java
/** * A variant of {@link #getCallIntent} for starting a video call. *//*w w w.j ava 2 s .c o m*/ public static Intent getVideoCallIntent(String number, String callOrigin) { final Intent intent = new Intent(Intent.ACTION_CALL, getCallUri(number)); intent.putExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, VideoProfile.STATE_BIDIRECTIONAL); if (!TextUtils.isEmpty(callOrigin)) { intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, callOrigin); } return intent; }
From source file:net.evecom.androidecssp.activity.EmergencyNotification.java
public void call(View view) { // Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:13850157372")); Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:18259154949")); startActivity(intent);//from w w w .j a v a 2s . com }
From source file:com.yutong.axxc.parents.view.common.ActivityUtils.java
/** * ????/*www . j a v a 2s .com*/ * @param activity * @param telNumber */ public static void call(Activity activity, String telNumber) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + telNumber)); activity.startActivity(intent); }
From source file:org.fs.galleon.presenters.ContactFragmentPresenter.java
@Override public void onStart() { if (view.isAvailable()) { if (contact != null) { view.setPhone(contact.getPhone()); view.setAddress(contact.getAddress()); String cityName = contact.getCity() != null ? contact.getCity().getCityName() : StringUtility.EMPTY; String countryName = contact.getCountry() != null ? contact.getCountry().getCountryName() : StringUtility.EMPTY; if (!StringUtility.isNullOrEmpty(cityName) && !StringUtility.isNullOrEmpty(countryName)) { view.showCityAndCountry(); view.setCityAndCountry(String.format(Locale.getDefault(), "%s, %s", cityName, countryName)); } else { view.hideCityAndCountry(); }//w w w . java2 s .c om } dispatchAskPermissionsIfNeeded(); eventListener = BusManager.add((event) -> { if (event instanceof ApproveEvent) { ApproveEvent approveEvent = (ApproveEvent) event; if (approveEvent.isApproved()) { if (view.isAvailable()) { Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(String.format(Locale.ENGLISH, "tel:%s", contact.getPhone()))); view.startActivity(intent); } } } }); } }
From source file:com.rsamadhan.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w w w. j a va 2 s. co m*/ final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { /*Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG) .setAction("Action", null).show();*/ try { String uri = "tel:+919911490791"; Intent dialIntent = new Intent(Intent.ACTION_CALL, Uri.parse(uri)); startActivity(dialIntent); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Your call has failed...", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); }
From source file:com.app.jdy.widget.CustomSaveMoneyDialog.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.savemoney_dialog); listView = (ListView) findViewById(R.id.savemoney_listView); promoCodeTextView = (TextView) findViewById(R.id.PromoCode); listView.setOnItemClickListener(new OnItemClickListener() { @Override//w ww . java2 s .c om public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { addressTextView = (TextView) arg1.findViewById(R.id.address); Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + addressTextView.getText())); context.startActivity(intent); } }); new Thread(ManagerRunnable).start(); mHandler = new Handler() { @Override public void handleMessage(Message msg) {// ui? switch (msg.what) { case 2: customManagerAdapter = new CustomManagerAdapter(context, listViewProductManagerList); listView.setAdapter(customManagerAdapter); break; case 3: promoCodeTextView.setText(coupon); break; default: break; } } }; }
From source file:com.amlcurran.messages.notifications.NotificationActionBuilder.java
private PendingIntent callPendingIntent(PhoneNumber number) { Uri telUri = Uri.parse("tel:" + number.flatten()); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(telUri);/* w w w.j a v a2s. c o m*/ return PendingIntent.getActivity(context, 12121, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:com.njlabs.amrita.aid.about.Amrita.java
public void call_cbe(View view) { String num = "+914222685000"; String number = "tel:" + num; Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number)); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { return;/*w ww .j a v a2s . c om*/ } startActivity(callIntent); startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "+914222685000"))); }