List of usage examples for android.content Intent ACTION_DIAL
String ACTION_DIAL
To view the source code for android.content Intent ACTION_DIAL.
Click Source Link
From source file:com.hybris.mobile.activity.StoreLocatorDetailActivity.java
public void onClickPhone(View v) { boolean validNr = false; if (store.getAddress() != null) { String phoneNr = store.getAddress().getPhone(); if (phoneNr != null && phoneNr.trim().length() > 0) { Uri telUrl = Uri.parse("tel:" + phoneNr.trim()); Intent intent = new Intent(Intent.ACTION_DIAL, telUrl); startActivity(intent);//w w w . j av a 2s . c o m validNr = true; } } if (!validNr) { Toast.makeText(getApplicationContext(), R.string.error_invalidPhoneNumber, Toast.LENGTH_SHORT).show(); } }
From source file:org.sipdroid.sipua.ui.Sipdroid.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.sipdroid);/*from www . jav a2s . co m*/ sip_uri_box = (AutoCompleteTextView) findViewById(R.id.txt_callee); sip_uri_box2 = (AutoCompleteTextView) findViewById(R.id.txt_callee2); sip_uri_box.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { call_menu(sip_uri_box); return true; } return false; } }); sip_uri_box.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { call_menu(sip_uri_box); } }); sip_uri_box2.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { call_menu(sip_uri_box2); return true; } return false; } }); sip_uri_box2.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { call_menu(sip_uri_box2); } }); on(this, true); Button contactsButton = (Button) findViewById(R.id.contacts_button); contactsButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(Intent.ACTION_DIAL); startActivity(myIntent); } }); final Context mContext = this; Button settingsButton = (Button) findViewById(R.id.settings_button); settingsButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(mContext, org.sipdroid.sipua.ui.Settings.class); startActivity(myIntent); } }); final OnDismissListener listener = this; createButton = (Button) findViewById(R.id.create_button); createButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { CreateAccount createDialog = new CreateAccount(mContext); createDialog.setOnDismissListener(listener); createDialog.show(); } }); if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Settings.PREF_NOPORT, Settings.DEFAULT_NOPORT)) { boolean ask = false; for (int i = 0; i < SipdroidEngine.LINES; i++) { String j = (i != 0 ? "" + i : ""); if (PreferenceManager.getDefaultSharedPreferences(this) .getString(Settings.PREF_SERVER + j, Settings.DEFAULT_SERVER) .equals(Settings.DEFAULT_SERVER) && PreferenceManager.getDefaultSharedPreferences(this) .getString(Settings.PREF_USERNAME + j, Settings.DEFAULT_USERNAME).length() != 0 && PreferenceManager.getDefaultSharedPreferences(this) .getString(Settings.PREF_PORT + j, Settings.DEFAULT_PORT) .equals(Settings.DEFAULT_PORT)) ask = true; } if (ask) new AlertDialog.Builder(this).setMessage(R.string.dialog_port) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Editor edit = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); for (int i = 0; i < SipdroidEngine.LINES; i++) { String j = (i != 0 ? "" + i : ""); if (PreferenceManager.getDefaultSharedPreferences(mContext) .getString(Settings.PREF_SERVER + j, Settings.DEFAULT_SERVER) .equals(Settings.DEFAULT_SERVER) && PreferenceManager.getDefaultSharedPreferences(mContext) .getString(Settings.PREF_USERNAME + j, Settings.DEFAULT_USERNAME) .length() != 0 && PreferenceManager.getDefaultSharedPreferences(mContext) .getString(Settings.PREF_PORT + j, Settings.DEFAULT_PORT) .equals(Settings.DEFAULT_PORT)) edit.putString(Settings.PREF_PORT + j, "5061"); } edit.commit(); Receiver.engine(mContext).halt(); Receiver.engine(mContext).StartEngine(); } }).setNeutralButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).setNegativeButton(R.string.dontask, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Editor edit = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); edit.putBoolean(Settings.PREF_NOPORT, true); edit.commit(); } }).show(); } else if (PreferenceManager.getDefaultSharedPreferences(this) .getString(Settings.PREF_PREF, Settings.DEFAULT_PREF).equals(Settings.VAL_PREF_PSTN) && !PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Settings.PREF_NODEFAULT, Settings.DEFAULT_NODEFAULT)) new AlertDialog.Builder(this).setMessage(R.string.dialog_default) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Editor edit = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); edit.putString(Settings.PREF_PREF, Settings.VAL_PREF_SIP); edit.commit(); } }).setNeutralButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).setNegativeButton(R.string.dontask, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Editor edit = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); edit.putBoolean(Settings.PREF_NODEFAULT, true); edit.commit(); } }).show(); }
From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); // Get the selected item from the listview adapter final KeyValuePair kvp = m_adapter.getItem(info.position); switch (item.getItemId()) { case MENU_ID_CALL: Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" //$NON-NLS-1$ + kvp.getValue()));/*from w ww . j av a 2s . c o m*/ startActivity(intent); break; case MENU_ID_SMS: intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" //$NON-NLS-1$ + kvp.getValue())); startActivity(intent); break; case MENU_ID_COPY_TO_CLIPBOARD: final ClipboardManager clipboard = (ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(kvp.getValue()); Toast.makeText(this.getActivity(), getString(R.string.text_copied_to_clipboard), Toast.LENGTH_SHORT) .show(); break; case MENU_ID_EDIT_BEFORE_CALL: intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" //$NON-NLS-1$ + kvp.getValue())); startActivity(intent); break; case MENU_ID_EMAIL: intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); //$NON-NLS-1$ intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { kvp.getValue() }); startActivity(Intent.createChooser(intent, getString(R.string.send_mail))); break; default: return super.onContextItemSelected(item); } return true; }
From source file:org.jraf.android.dcn.handheld.app.geofencing.GeofencingService.java
private void showEnteredNotification(AddressInfo addressInfo) { Log.d("addressInfo=" + addressInfo); String titleShort = getNotificationTitle(addressInfo, false); String titleLong = getNotificationTitle(addressInfo, true); String textShort = getNotificationText(addressInfo, false); String textLong = getNotificationText(addressInfo, true); NotificationCompat.Builder mainNotifBuilder = new NotificationCompat.Builder(this); // Small icon mainNotifBuilder.setSmallIcon(R.drawable.ic_stat_entered); // Make a bigger title SpannableString titleSpannable = new SpannableString(titleShort); Object span = new TextAppearanceSpan(this, R.style.NotificationContentTitleTextAppearance); titleSpannable.setSpan(span, 0, titleShort.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // Title//from w ww. j a v a 2 s . c o m mainNotifBuilder.setContentTitle(titleSpannable); // Ticker mainNotifBuilder.setTicker(titleShort); // Text (short) mainNotifBuilder.setContentText(textShort); // Text (long) mainNotifBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textLong)); // Misc mainNotifBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); // Time sensitive, try to appear on top mainNotifBuilder.setCategory(NotificationCompat.CATEGORY_STATUS); // Not sure if this category is really the most appropriate mainNotifBuilder.setLights(0, 0, 0); // No light mainNotifBuilder.setShowWhen(false); // No date mainNotifBuilder.addPerson(addressInfo.contactInfo.contentLookupUri.toString()); // Contact photo Bitmap contactPhoto = addressInfo.getContactPhoto(this); if (contactPhoto != null) mainNotifBuilder.setLargeIcon(contactPhoto); // Dismiss intent Intent dismissIntent = new Intent(ACTION_DISMISS_NOTIFICATION, null, this, getClass()); PendingIntent dismissPendingIntent = PendingIntent.getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); mainNotifBuilder.setDeleteIntent(dismissPendingIntent); // Main action (click on the notification itself) Intent mainIntent = new Intent(Intent.ACTION_VIEW); mainIntent.setData(addressInfo.contactInfo.contentLookupUri); PendingIntent mainPendingIntent = PendingIntent.getActivity(this, 0, mainIntent, PendingIntent.FLAG_UPDATE_CURRENT); mainNotifBuilder.setContentIntent(mainPendingIntent); String phoneNumber = addressInfo.getContactPhoneNumber(this); if (phoneNumber != null) { // Call action Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + phoneNumber)); PendingIntent callPendingIntent = PendingIntent.getActivity(this, 0, callIntent, PendingIntent.FLAG_UPDATE_CURRENT); String callText = getString(R.string.notification_action_call); mainNotifBuilder.addAction(R.drawable.ic_action_call, callText, callPendingIntent); // Sms action Intent smsIntent = new Intent(Intent.ACTION_VIEW); smsIntent.setData(Uri.parse("sms:" + phoneNumber)); smsIntent.putExtra("sms_body", getString(R.string.notification_action_sms_body)); PendingIntent smsPendingIntent = PendingIntent.getActivity(this, 0, smsIntent, PendingIntent.FLAG_UPDATE_CURRENT); String smsText = getString(R.string.notification_action_sms); mainNotifBuilder.addAction(R.drawable.ic_action_sms, smsText, smsPendingIntent); } // Since we have a specific Wear notification, show this one only on handheld mainNotifBuilder.setLocalOnly(true); // Show it Notification notification = mainNotifBuilder.build(); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIFICATION_ID, notification); // Show a Wear notification // Blocking mWearHelper.connect(this); mWearHelper.putNotification(titleLong, textShort, textLong, contactPhoto, addressInfo.contactInfo.contentLookupUri, phoneNumber); }
From source file:com.siso.app.adapter.GoodsDetailAdapter.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.item_goods_detail_call: if (entity.getContactPhone() != null) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_DIAL); Uri uri = Uri.parse("tel:" + entity.getContactPhone()); intent.setData(uri);/*w w w . java 2 s .c om*/ context.startActivity(intent); } else { Toast.makeText(context, context.getResources().getString(R.string.tip_goodsdetail_contact_phone), Toast.LENGTH_SHORT).show(); } break; case R.id.item_goods_detail_chat: if (MyApplication.userInfo != null) { chat(); } else { Toast.makeText(context, context.getResources().getString(R.string.has_no_login), Toast.LENGTH_SHORT) .show(); } break; case R.id.item_goods_detail_username: startUserDetailActivity(); break; case R.id.item_goods_desp_avatar: startUserDetailActivity(); break; default: break; } }
From source file:eu.codeplumbers.cosi.activities.CozyActivity.java
@Override public void onListFragmentInteraction(final Call call) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.dial_this_number) .setPositiveButton(R.string.YES, new DialogInterface.OnClickListener() { @Override/*w w w . java2 s .co m*/ public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + call.getCallerNumber())); startActivity(intent); } }).setNegativeButton(R.string.NO, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }).show(); }
From source file:net.olejon.mdapp.PoisoningsCardsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { NavUtils.navigateUpFromSameTask(this); return true; }/*ww w . j a va2 s . co m*/ case R.id.poisonings_cards_menu_call: { try { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+4722591300")); startActivity(intent); } catch (Exception e) { new MaterialDialog.Builder(mContext).title(getString(R.string.device_not_supported_dialog_title)) .content(getString(R.string.device_not_supported_dialog_message)) .positiveText(getString(R.string.device_not_supported_dialog_positive_button)) .contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue).show(); } return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.hyzs.onekeyhelp.module.housekeeping.activity.AgencyServiceDetailActivity.java
@Override public void onClick(View v) { Intent intent = null;// w ww . ja v a 2 s . co m switch (v.getId()) { case R.id.toolbar_right: intent = new Intent(this, ServiceComplaintsActivity.class); intent.putExtra("icon", bean.getBasicInfo().getLogo()); intent.putExtra("name", bean.getBasicInfo().getName()); intent.putExtra("LS_ID", getIntent().getStringExtra("LS_ID")); startActivity(intent); break; case R.id.toolbar_back: finish(); break; case R.id.activity_agency_service_detail_chat: MySharedPreferences.getInstance(this).setString("Img", bean.getBasicInfo().getLogo()); NotifyMsgCountUtil.notifyMsg(bean.getBasicInfo().getUserid() + ""); intent = new Intent(); intent.putExtra("one", bean.getBasicInfo().getUserid() + ""); intent.putExtra("userName", bean.getBasicInfo().getName()); intent.setClass(this, IntentChatActivity.class); startActivity(intent); break; case R.id.activity_agency_service_detail_reservation: intent = new Intent(this, ServiceProjectListActivity.class); intent.putExtra("LS_ID", getIntent().getStringExtra("LS_ID")); startActivity(intent); break; case R.id.activity_agency_service_detail_call_phone: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (getApplicationContext() .checkSelfPermission(Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { Toast.makeText(this, "???", Toast.LENGTH_SHORT).show(); } else { if (!TextUtils.isEmpty(bean.getBasicInfo().getTel())) { intent = new Intent(Intent.ACTION_DIAL); Uri data = Uri.parse("tel:" + bean.getBasicInfo().getTel()); intent.setData(data); startActivity(intent); } } } else { if (!TextUtils.isEmpty(bean.getBasicInfo().getTel())) { intent = new Intent(Intent.ACTION_DIAL); Uri data = Uri.parse("tel:" + bean.getBasicInfo().getTel()); intent.setData(data); startActivity(intent); } } break; case R.id.activity_agency_service_detail_comment_detail: intent = new Intent(this, ServiceCommentListActivity.class); intent.putExtra("LS_ID", getIntent().getStringExtra("LS_ID")); intent.putExtra("basicInfo", bean.getBasicInfo()); startActivity(intent); break; case R.id.activity_agency_service_detail_project_detail: intent = new Intent(this, ServiceProjectListActivity.class); intent.putExtra("LS_ID", getIntent().getStringExtra("LS_ID")); startActivity(intent); break; case R.id.activity_agency_service_horizontal_left: if (headViewPager.getCurrentItem() > 0) { headViewPager.setCurrentItem(headViewPager.getCurrentItem() - 1); } break; case R.id.activity_agency_service_horizontal_right: if (headViewPager.getCurrentItem() < imgList.size() - 1) { headViewPager.setCurrentItem(headViewPager.getCurrentItem() + 1); } break; } }
From source file:br.com.PartoHumanizado.fragment.DenucieFragment.java
private void call() { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "180")); startActivity(intent); }
From source file:com.nadmm.airports.FragmentBase.java
protected void makeClickToCall(TextView tv) { PackageManager pm = mActivity.getPackageManager(); boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); if (hasTelephony && tv.getText().length() > 0) { UiUtils.setTextViewDrawable(tv, R.drawable.ic_phone); tv.setTag(Intent.ACTION_DIAL); tv.setOnClickListener(mOnPhoneClickListener); } else {/*from w ww . ja va 2s . co m*/ UiUtils.removeTextViewDrawable(tv); tv.setOnClickListener(null); } }