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.android.dialer.DialtactsActivity.java
/** Returns true if the given intent contains a phone number to populate the dialer with */ private boolean isDialIntent(Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_DIAL.equals(action) || ACTION_TOUCH_DIALER.equals(action)) { return true; }// www . j a v a 2s .com if (Intent.ACTION_VIEW.equals(action)) { final Uri data = intent.getData(); if (data != null && PhoneAccount.SCHEME_TEL.equals(data.getScheme())) { return true; } } return false; }
From source file:com.lewa.crazychapter11.MainActivity.java
private void AddNoification() { nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Button btn_send = (Button) findViewById(R.id.btn_send); Button btn_cancel = (Button) findViewById(R.id.btn_cancel); /*/*ww w.j a v a 2 s. c om*/ * btn_send.setOnClickListener(new OnClickListener() { * * @Override public void onClick(View source) { // acionBar.show(); * EditText show_txt=(EditText)findViewById(R.id.show_txt); * show_txt.setText("yong onClick chufa de"); } }); */ btn_send.setOnClickListener(new OnClickListener() { @Override public void onClick(View source) { Intent intent = new Intent(); // acionBar.hide(); /* * Intent intent = new Intent(MainActivity.this, * MainActivity.class); startActivity(intent); */ /* * Toast.makeText(this, "???" + "\n ??" + screen, * Toast.LENGTH_LONG).show(); */ /* * Message msg = new Message(); msg.what = 0x4567; * handler.sendMessage(msg); */ // */ // intent.setClass(MainActivity.this, GestureFlip.class); // */ intent.setClass(MainActivity.this, HTMLActivity.class); // intent.setClass(MainActivity.this, HTMLMainActivity.class); startActivity(intent); } }); btn_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View source) { // acionBar.hide(); Intent intent = new Intent(); // intent.setAction("android.intent.action.OTHERACTIVITY"); // intent.addCategory("android.intent.category.OTHERACTIVITY"); // intent.setAction(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_HOME); // intent.setDataAndType(Uri.parse("lee://www.fkjava.org:8888/mypath"),"abc/xyz"); // /ACTION_VIEW /* * / String data = "http://www.baidu.com"; Uri uri = * Uri.parse(data); intent.setAction(Intent.ACTION_VIEW); * intent.setData(uri); / */ // /ACTION_EDIT /* * / intent.setAction(Intent.ACTION_EDIT); * intent.setData(Uri.parse * ("content://com.android.contacts/contacts/1")); // */ // /ACTION_EDIT intent.setAction(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:10086")); // /ACTION_res /* * / intent.setClass(MainActivity.this,ValuesResTest.class); // */ // /ACTION_res /* * / intent.setClass(MainActivity.this, ClipDrawableTest.class); * // */ /* * / intent.setClass(MainActivity.this, LewaBitmapTest.class); * // */ /* * / intent.setClass(MainActivity.this, LewaDrawView.class); // */ /* * / intent.setClass(MainActivity.this, HandDraw.class); // */ /* * / intent.setClass(MainActivity.this, MoveBack.class); // */ /* * / intent.setClass(MainActivity.this, SurfaceViewTest.class); * // */ /* * / intent.setClass(MainActivity.this, DBTest.class); // */ /* * / intent.setClass(MainActivity.this, Dict.class); // */ /* * / intent.setClass(MainActivity.this, GestureZoom.class); // */ // */ // intent.setClass(MainActivity.this, GestureFlip.class); // */ // intent.addCategory("android.intent.category.APP_CALCULATOR"); // PackageManager packageManager = MainActivity.this.getPackageManager(); // try { // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent =packageManager.getLaunchIntentForPackage("com.android.calculator2"); // startActivity(intent); // } catch (Exception e) { // Log.i("algerheMain", e.toString()); // } // Intent i = new Intent(Intent.ACTION_MAIN); // i.setComponent(new ComponentName("com.android.calculator2", // "com.android.calculator2.Calculator")); // i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // startActivity(i); } }); }
From source file:com.ieeton.agency.activity.ChatActivity.java
/** * ?//from w ww .j a v a 2 s . c om * * @param view */ @Override public void onClick(View view) { int id = view.getId(); if (id == R.id.btn_send) {// ??(?) String s = mEditTextContent.getText().toString(); sendText(s); } else if (id == R.id.btn_quick_reply) { startActivityForResult(new Intent(this, ReplyTemplateActivity.class), REQUEST_CODE_QUICK_REPLY); } else if (id == R.id.btn_take_picture) { selectPicFromCamera();// } else if (id == R.id.btn_picture) { selectPicFromLocal(); // } else if (id == R.id.btn_location) { // ? startActivityForResult(new Intent(this, BaiduMapActivity.class), REQUEST_CODE_MAP); } else if (id == R.id.iv_emoticons_normal) { // more.setVisibility(View.VISIBLE); //iv_emoticons_normal.setVisibility(View.INVISIBLE); //iv_emoticons_checked.setVisibility(View.VISIBLE); btnContainer.setVisibility(View.GONE); expressionContainer.setVisibility(View.VISIBLE); hideKeyboard(); } else if (id == R.id.iv_emoticons_checked) { // ?? //iv_emoticons_normal.setVisibility(View.VISIBLE); //iv_emoticons_checked.setVisibility(View.INVISIBLE); btnContainer.setVisibility(View.VISIBLE); expressionContainer.setVisibility(View.GONE); more.setVisibility(View.GONE); } else if (id == R.id.btn_video) { // ? Intent intent = new Intent(ChatActivity.this, ImageGridActivity.class); startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO); } else if (id == R.id.btn_file) { // selectFileFromLocal(); } else if (id == R.id.btn_voice_call) { //? if (!EMChatManager.getInstance().isConnected()) Toast.makeText(this, "????", 0).show(); else startActivity(new Intent(ChatActivity.this, VoiceCallActivity.class) .putExtra("username", toChatUsername).putExtra("isComingCall", false)); } else if (id == R.id.iv_add) { followPatient(); } else if (id == R.id.iv_share) { if (mChatUser != null) { Intent intent = new Intent(this, ShareChatHistory.class); intent.putExtra(EXTRA_USERINFO, mChatUser); intent.putExtra(EXTRA_USERID, mChatUser.getId()); startActivity(intent); } } else if (id == R.id.btn_photo) { showPop();// } else if (id == R.id.iv_call) { String number = NetEngine.getIvrNumber(); if (number != null && !"".equals(number)) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)); try { startActivity(intent); } catch (Exception e) { e.printStackTrace(); } } } else if (view == mBackBtn) { finish(); } }
From source file:com.trukr.shipper.fragment.RequestStatus.java
public void contactalertDialog(final Context ctx, String Title, String Content) { final Dialog dialog = new Dialog(ctx, R.style.Dialog); dialog.setCancelable(false);/*w ww . j av a2 s.c o m*/ dialog.setContentView(R.layout.contactalertdialog); TextView alertHead = (TextView) dialog.findViewById(R.id.tv_alerthead); alertHead.setText(Title); TextView alertContent = (TextView) dialog.findViewById(R.id.tv_alertcontent); alertContent.setText(Content); Button btnDialogOk = (Button) dialog.findViewById(R.id.btn_text); Button btnDialogCancel = (Button) dialog.findViewById(R.id.btn_call); // if button is clicked, close the custom dialog btnDialogOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent smsIntent = new Intent(android.content.Intent.ACTION_VIEW); smsIntent.setData(Uri.parse("sms:" + driverContactValue.toString())); startActivity(smsIntent); dialog.dismiss(); } }); btnDialogCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri phoneCall = Uri.parse("tel:" + driverContactValue.toString()); Intent caller = new Intent(Intent.ACTION_DIAL, phoneCall); startActivity(caller); } }); dialog.show(); }
From source file:nl.mpcjanssen.simpletask.Simpletask.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Task t = getTaskAt(position);/*from w w w. j a va 2s. c o m*/ final ArrayList<String> actions = new ArrayList<>(); final ArrayList<String> links = new ArrayList<>(); for (String link : t.getLinks()) { actions.add(ACTION_LINK); links.add(link); } for (String number : t.getPhoneNumbers()) { actions.add(ACTION_PHONE); links.add(number); } for (String mail : t.getMailAddresses()) { actions.add(ACTION_MAIL); links.add(mail); } final String[] linksArray = links.toArray(new String[0]); if (linksArray.length == 0) { getListView().setItemChecked(position, !getListView().isItemChecked(position)); } else { AlertDialog.Builder build = new AlertDialog.Builder(this); build.setItems(linksArray, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent; String url = links.get(which); Log.v(TAG, "" + actions.get(which) + ": " + url); switch (actions.get(which)) { case ACTION_LINK: if (url.startsWith("todo://")) { File todoFolder = m_app.getTodoFile().getParentFile(); File newName = new File(todoFolder, url.substring(7)); m_app.switchTodoFile(newName); } else { intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); } break; case ACTION_PHONE: String encodedNumber = Uri.encode(url); intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + encodedNumber)); startActivity(intent); break; case ACTION_MAIL: intent = new Intent(Intent.ACTION_SEND, Uri.parse(url)); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { url }); intent.setType("text/plain"); startActivity(intent); } } }); build.create().show(); } return; }
From source file:org.thoughtcrime.securesms.ProfileFragment.java
private void handleDial(Recipient recipient) { try {/* ww w . ja v a 2s. c o m*/ if (recipient == null) return; Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + recipient.getNumber())); startActivity(dialIntent); } catch (ActivityNotFoundException anfe) { Dialogs.showAlertDialog(getActivity(), getString(R.string.ConversationActivity_calls_not_supported), getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions)); } }
From source file:com.todotxt.todotxttouch.TodoTxtTouch.java
void showContextActionBarIfNeeded() { ArrayList<Task> checkedTasks = getCheckedTasks(); int checkedCount = checkedTasks.size(); if (inActionMode() && checkedCount == 0) { mMode.finish();/*from w ww . jav a 2 s . co m*/ return; } else if (checkedCount == 0) { return; } if (mMode == null) { m_swipeList.setEnabled(false); mMode = startActionMode(new Callback() { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { getSupportMenuInflater().inflate(R.menu.main_long, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { ArrayList<Task> checkedTasks = getCheckedTasks(); int menuid = item.getItemId(); Intent intent; switch (menuid) { case R.id.update: if (checkedTasks.size() == 1) { editTask(checkedTasks.get(0)); } else { Log.w(TAG, "More than one task was selected while handling update menu"); } break; case R.id.done: completeTasks(checkedTasks, true); break; case R.id.priority: prioritizeTasks(checkedTasks); break; case R.id.share: shareTasks(checkedTasks); break; case R.id.calendar: addToCalendar(checkedTasks); break; case R.id.uncomplete: undoCompleteTasks(checkedTasks, true); break; case R.id.delete: deleteTasks(checkedTasks); break; case R.id.url: Log.v(TAG, "url: " + item.getTitle().toString()); intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.getTitle().toString())); startActivity(intent); break; case R.id.mail: Log.v(TAG, "mail: " + item.getTitle().toString()); intent = new Intent(Intent.ACTION_SEND, Uri.parse(item.getTitle().toString())); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { item.getTitle().toString() }); intent.setType("text/plain"); startActivity(intent); break; case R.id.phone_number: Log.v(TAG, "phone_number"); intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + item.getTitle().toString())); startActivity(intent); break; default: Log.w(TAG, "unrecognized menuItem: " + menuid); } mMode.finish(); return true; } @Override public void onDestroyActionMode(ActionMode mode) { getListView().clearChoices(); m_adapter.notifyDataSetChanged(); m_swipeList.setEnabled(true); mMode = null; } }); } mMode.setTitle(checkedCount + " " + getString(R.string.selected)); Menu menu = mMode.getMenu(); MenuItem updateAction = menu.findItem(R.id.update); MenuItem completeAction = menu.findItem(R.id.done); MenuItem uncompleteAction = menu.findItem(R.id.uncomplete); // Only show update action with a single task selected if (checkedCount == 1) { updateAction.setVisible(true); Task task = checkedTasks.get(0); if (task.isCompleted()) { completeAction.setVisible(false); } else { uncompleteAction.setVisible(false); } for (URL url : task.getLinks()) { menu.add(Menu.CATEGORY_SECONDARY, R.id.url, Menu.NONE, url.toString()); } for (String s1 : task.getMailAddresses()) { menu.add(Menu.CATEGORY_SECONDARY, R.id.mail, Menu.NONE, s1); } for (String s : task.getPhoneNumbers()) { menu.add(Menu.CATEGORY_SECONDARY, R.id.phone_number, Menu.NONE, s); } } else { updateAction.setVisible(false); completeAction.setVisible(true); uncompleteAction.setVisible(true); menu.removeGroup(Menu.CATEGORY_SECONDARY); } }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public boolean onMarkerClick(final Marker theMarker) { if (theMarker.equals(MyAppConstants.myMarker)) { return false; }/*from ww w .j a va 2 s . c o m*/ // Normal Marker if (!theMarker.equals(MyAppConstants.myMarker) && (theMarker.getTitle() != null)) { final Dialog aMemberDialog = new Dialog(TeamViewActivity.this, R.style.DialogSlideAnim); aMemberDialog.setContentView(R.layout.member_dialog); TextView aMemberTextName = (TextView) aMemberDialog.findViewById(R.id.tvMemberName); Button aTextButton = (Button) aMemberDialog.findViewById(R.id.bMemberText); Button aPushButton = (Button) aMemberDialog.findViewById(R.id.bMemberPush); Button aCallButton = (Button) aMemberDialog.findViewById(R.id.bMemberCall); Button aRemoveButton = (Button) aMemberDialog.findViewById(R.id.bMemberRemove); String[] res = theMarker.getTitle().split("~"); String title = res[0]; final String phone = res[1]; aMemberTextName.setText("Say hello to " + title + "!"); aMemberDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); aMemberDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); aMemberDialog.getWindow().setGravity(Gravity.BOTTOM); aMemberDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); aMemberDialog.show(); ImageView aCancelButton = (ImageView) aMemberDialog.findViewById(R.id.bCancelMemberDialog); aCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { aMemberDialog.dismiss(); } }); aTextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri sms_uri = Uri.parse("smsto:" + phone); Intent sms_intent = new Intent(Intent.ACTION_SENDTO, sms_uri); startActivity(sms_intent); } }); // aPushButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // // startActivity(new Intent(Intent.ACTION_VIEW, // // Uri.parse("sms:" // // + theMarker.getSnippet()))); // } // }); aCallButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + phone)); startActivity(callIntent); } }); // aRemoveButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // } // }); } else { StickyMarkerBehaviorDialog dialog = new StickyMarkerBehaviorDialog(this); dialog.show(); } return true; }
From source file:org.thoughtcrime.securesms.conversation.ConversationActivity.java
private void handleDial(final Recipient recipient, boolean isSecure) { if (recipient == null) return;//from w ww . j a v a 2 s . c o m if (isSecure) { CommunicationActions.startVoiceCall(this, recipient); } else { try { Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + recipient.getAddress().serialize())); startActivity(dialIntent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, anfe); Dialogs.showAlertDialog(this, getString(R.string.ConversationActivity_calls_not_supported), getString( R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions)); } } }
From source file:org.telegram.ui.ProfileActivity.java
private boolean processOnClickOrPress(final int position) { if (position == usernameRow) { final TLRPC.User user = MessagesController.getInstance().getUser(user_id); if (user == null || user.username == null) { return false; }/* ww w . j a v a 2 s. c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setItems(new CharSequence[] { LocaleController.getString("Copy", R.string.Copy) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { try { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext .getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", "@" + user.username); clipboard.setPrimaryClip(clip); } catch (Exception e) { FileLog.e("tmessages", e); } } } }); showDialog(builder.create()); return true; } else if (position == phoneRow) { final TLRPC.User user = MessagesController.getInstance().getUser(user_id); if (user == null || user.phone == null || user.phone.length() == 0 || getParentActivity() == null) { return false; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setItems( new CharSequence[] { LocaleController.getString("Call", R.string.Call), LocaleController.getString("Copy", R.string.Copy) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { try { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+" + user.phone)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getParentActivity().startActivityForResult(intent, 500); } catch (Exception e) { FileLog.e("tmessages", e); } } else if (i == 1) { try { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext .getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", "+" + user.phone); clipboard.setPrimaryClip(clip); } catch (Exception e) { FileLog.e("tmessages", e); } } } }); showDialog(builder.create()); return true; } else if (position == channelInfoRow || position == userInfoRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setItems(new CharSequence[] { LocaleController.getString("Copy", R.string.Copy) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { try { String about; if (position == channelInfoRow) { about = info.about; } else { about = MessagesController.getInstance().getUserAbout(botInfo.user_id); } if (about == null) { return; } android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext .getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", about); clipboard.setPrimaryClip(clip); } catch (Exception e) { FileLog.e("tmessages", e); } } }); showDialog(builder.create()); return true; } return false; }