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.vignesh.conf.MainActivity.java
@Override protected void onResume() { super.onResume(); List<String> list = new ArrayList<>(); final ListView listView = (ListView) findViewById(R.id.info); Cursor cursor;/* ww w .j a v a2 s .c om*/ long time = new Date().getTime(); ContentResolver contentResolver = getContentResolver(); Uri uri = CalendarContract.Calendars.CONTENT_URI; SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); String cal = sharedPreferences.getString(CALENDAR_NAME, getResources().getString(R.string.no_calendar)); String selection = "((" + CalendarContract.Calendars.ACCOUNT_NAME + " = ?))"; int hours_before = Integer.valueOf(sharedPreferences.getString("past_hours", "2")); int hours_future = Integer.valueOf(sharedPreferences.getString("future_hours", "24")); String[] selectionArgs = new String[] { cal }; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) { Toast.makeText(getApplicationContext(), "No calendar permission", Toast.LENGTH_LONG).show(); finish(); return; } if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { Toast.makeText(getApplicationContext(), "No calling permission", Toast.LENGTH_LONG).show(); finish(); return; } cursor = contentResolver.query(uri, CAL_PROJECTION, selection, selectionArgs, null); assert cursor != null; while (cursor.moveToNext()) { long calID = 0; // Get the field values calID = cursor.getLong(PROJECTION_ID_INDEX); Uri.Builder instanceUriBuilder = CalendarContract.Instances.CONTENT_URI.buildUpon(); ContentUris.appendId(instanceUriBuilder, time - hours_before * 60 * 60 * 1000); ContentUris.appendId(instanceUriBuilder, time + hours_future * 60 * 60 * 1000); Uri instanceUri = instanceUriBuilder.build(); String instanceSelection = "((" + CalendarContract.Instances.CALENDAR_ID + "= ?))"; String[] instanceSelectionArgs = new String[] { "" + calID }; Cursor instanceCursor = contentResolver.query(instanceUri, INSTANCE_PROJECTION, instanceSelection, instanceSelectionArgs, CalendarContract.Instances.BEGIN + " ASC"); assert instanceCursor != null; while (instanceCursor.moveToNext()) { String title = instanceCursor.getString(1); Date begin = new Date(instanceCursor.getLong(2)); Date end = new Date(instanceCursor.getLong(3)); String loc = instanceCursor.getString(4); String desc = instanceCursor.getString(5); String full = title + "\n" + loc + "\n" + desc; Pattern passcodePattern = Pattern .compile(sharedPreferences.getString(REGEX, "(\\d{8})[\\s\\t\\n#]")); Matcher passcodeMatcher = passcodePattern.matcher(full); String list_item = (title + "\n" + "START: " + begin + "\nEND: " + end + "\n"); if (passcodeMatcher.find()) list.add(list_item + "Conf code: " + passcodeMatcher.group().trim() + "\n"); } instanceCursor.close(); } cursor.close(); ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getApplicationContext(), R.layout.list_layout, list); assert listView != null; listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String s = (String) parent.getItemAtPosition(position); SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); String tel = sharedPreferences.getString(CONTACT_NUM, getResources().getString(R.string.no_contact)); Pattern pattern = Pattern.compile(sharedPreferences.getString(REGEX, "(\\d{8})[\\s\\t\\n#]")); Matcher matcher = pattern.matcher(s); if (matcher.find()) { if (!tel.equals(getResources().getString(R.string.no_contact))) { String[] contact = tel.split(": "); String suffix = sharedPreferences.getString(SUFFIX, ""); if (suffix != null) try { suffix = URLEncoder.encode(suffix, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String prefix = sharedPreferences.getString(PREFIX, ""); if (prefix != null) try { prefix = URLEncoder.encode(prefix, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + contact[1] + "%3B" + prefix + matcher.group() + suffix)); if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED) { startActivity(intent); } } else { new AlertDialog.Builder(MainActivity.this).setTitle("No contact Selected!") .setMessage("Please Select Conference Call number via Settings Menu").show(); } } } }); }
From source file:fr.project.mlignereux.cv.view.fragment.ContactFragment.java
private void call(final String number) { mFab1.setOnClickListener(new View.OnClickListener() { @Override// ww w .j av a2s . c o m public void onClick(View view) { if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.CALL_PHONE)) { // Show an explanation to the user *asynchronously* -- don't block // this thread waiting for the user's response! After the user // sees the explanation, try again to request the permission. AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage( "Vous devez autoriser l'application utiliser votre appareil pour tlphoner"); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { requestPermissions(new String[] { Manifest.permission.CALL_PHONE }, CALL_PERMISSION); } }); builder.setNegativeButton("Annuler", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } else { // No explanation needed, we can request the permission. requestPermissions(new String[] { Manifest.permission.CALL_PHONE }, CALL_PERMISSION); } } else { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + number)); startActivity(callIntent); } } }); }
From source file:com.example.places.fragments.PlaceInfoFragment.java
@Override public void onPlaceFieldSelected(PlaceFieldData placeFieldData) { try {/*from w w w . ja v a 2 s. c o m*/ Intent intent = placeFieldData.getActionIntent(); if (Intent.ACTION_CALL.equals(intent.getAction())) { listener.onCallPhone(intent); } else { getActivity().startActivity(intent); } } catch (ActivityNotFoundException e) { Log.e(TAG, "failed to start activity", e); } }
From source file:com.bytestemplar.tonedef.touchpad.TouchPadActivity.java
public void clickDial(View v) { Editable text = _et_dialing_string.getText(); if (text != null) { /* @robo/* ww w . j a va2 s . c o m*/ don't play the number again, i already pressed the buttons with the tone, instead actually dial the number ;-) */ //playDialingString( text.toString() ); String uriString = "tel:" + text; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uriString)); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CALL_PHONE }, 1234); } startActivity(intent); // clear the EditText field _et_dialing_string.setText(""); } }
From source file:com.openarc.nirmal.mytrack.ContactActivity.java
private void showContactDialog(final Contact contact) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ContactActivity.this); View dialogView = getLayoutInflater().inflate(R.layout.dialog_view_contact, null); alertDialogBuilder.setView(dialogView); ImageView ivClose = (ImageView) dialogView.findViewById(R.id.ivClose); ImageView ivBackground = (ImageView) dialogView.findViewById(R.id.ivBackground); ImageView civContactImage = (CircleImageView) dialogView.findViewById(R.id.civContactImage); TextView tvContactName = (TextView) dialogView.findViewById(R.id.tvContactName); TextView tvCallNumber = (TextView) dialogView.findViewById(R.id.tvCallNumber); TextView tvMessageNumber = (TextView) dialogView.findViewById(R.id.tvMessageNumber); CardView callCardView = (CardView) dialogView.findViewById(R.id.cvCall); CardView smsCardView = (CardView) dialogView.findViewById(R.id.cvSMS); CardView emailCardView = (CardView) dialogView.findViewById(R.id.cvEmail); TextView tvEmail = (TextView) dialogView.findViewById(R.id.tvEmail); Picasso.with(ContactActivity.this).load(contact.image).into(ivBackground); Picasso.with(ContactActivity.this).load(contact.image).into(civContactImage); tvContactName.setText(contact.name); tvCallNumber.setText(contact.mobile); tvMessageNumber.setText(contact.mobile); tvEmail.setText(contact.email);//from w ww .j av a 2s . c o m final AlertDialog alertDialog = alertDialogBuilder.create(); ivClose.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { alertDialog.dismiss(); } return false; } }); callCardView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (!contact.mobile.contentEquals("")) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + contact.mobile)); if (ActivityCompat.checkSelfPermission(ContactActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { showToast("Cannot Make a Call"); } else { startActivity(callIntent); alertDialog.dismiss(); } } else { showToast("Not a valid mobile"); } } return false; } }); smsCardView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (!contact.mobile.contentEquals("")) { Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse("sms:" + contact.mobile)); startActivity(sendIntent); alertDialog.dismiss(); } else { showToast("Not a valid mobile"); } } return false; } }); emailCardView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (!contact.email.contentEquals("")) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { contact.email }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, ""); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); startActivity(emailIntent); alertDialog.dismiss(); } else { showToast("Not a valid email"); } } return false; } }); alertDialog.show(); }
From source file:com.gsma.rcs.ri.sharing.geoloc.InitiateGeolocSharing.java
private void initialize() { mGeolocSharingService = getGeolocSharingApi(); mSpinner = (Spinner) findViewById(R.id.contact); ContactListAdapter adapter = ContactListAdapter.createRcsContactListAdapter(this); mSpinner.setAdapter(adapter);/*w w w . ja va2 s. c om*/ OnClickListener btnInviteListener = new OnClickListener() { public void onClick(View v) { // Check if the service is available try { if (!mGeolocSharingService.isServiceRegistered()) { showMessage(R.string.error_not_registered); return; } // get selected phone number ContactListAdapter adapter = (ContactListAdapter) mSpinner.getAdapter(); String phoneNumber = adapter.getSelectedNumber(mSpinner.getSelectedView()); ContactId contact = ContactUtil.formatContact(phoneNumber); if (LogUtils.isActive) { Log.d(LOGTAG, "share geoloc=" + mGeoloc + " contact=" + contact); } mGeolocSharing = mGeolocSharingService.shareGeoloc(contact, mGeoloc); mSharingId = mGeolocSharing.getSharingId(); mSpinner.setEnabled(false); mInviteBtn.setVisibility(View.INVISIBLE); mSelectBtn.setVisibility(View.INVISIBLE); mDialBtn.setVisibility(View.INVISIBLE); } catch (RcsServiceNotAvailableException e) { showMessage(R.string.label_service_not_available); } catch (RcsServiceException e) { showExceptionThenExit(e); } } }; mInviteBtn = (Button) findViewById(R.id.invite_btn); mInviteBtn.setOnClickListener(btnInviteListener); mInviteBtn.setEnabled(false); OnClickListener btnSelectListener = new OnClickListener() { public void onClick(View v) { // Start a new activity to send a geolocation startActivityForResult(new Intent(InitiateGeolocSharing.this, EditGeoloc.class), SELECT_GEOLOCATION); } }; mSelectBtn = (Button) findViewById(R.id.select_btn); mSelectBtn.setOnClickListener(btnSelectListener); mSelectBtn.setEnabled(false); OnClickListener btnDialListener = new OnClickListener() { public void onClick(View v) { // get selected phone number ContactListAdapter adapter = (ContactListAdapter) mSpinner.getAdapter(); String phoneNumber = adapter.getSelectedNumber(mSpinner.getSelectedView()); // Initiate a GSM call before to be able to share content Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:".concat(phoneNumber))); if (ActivityCompat.checkSelfPermission(InitiateGeolocSharing.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { return; } startActivity(intent); } }; mDialBtn = (Button) findViewById(R.id.dial_btn); mDialBtn.setOnClickListener(btnDialListener); mDialBtn.setEnabled(false); mStatusView = (TextView) findViewById(R.id.progress_status); mPositionView = (TextView) findViewById(R.id.position); mProgressBar = (ProgressBar) findViewById(R.id.progress_bar); updateProgressBar(0, 0); mPositionView.setText(""); if (adapter == null || adapter.getCount() != 0) { mDialBtn.setEnabled(true); mSelectBtn.setEnabled(true); } mListener = new GeolocSharingListener() { @Override public void onProgressUpdate(ContactId contact, String sharingId, final long currentSize, final long totalSize) { /* Discard event if not for current sharingId */ if (InitiateGeolocSharing.this.mSharingId == null || !InitiateGeolocSharing.this.mSharingId.equals(sharingId)) { return; } mHandler.post(new Runnable() { public void run() { updateProgressBar(currentSize, totalSize); } }); } @Override public void onStateChanged(final ContactId contact, String sharingId, final GeolocSharing.State state, GeolocSharing.ReasonCode reasonCode) { if (LogUtils.isActive) { Log.d(LOGTAG, "onStateChanged contact=" + contact + " sharingId=" + sharingId + " state=" + state + " reason=" + reasonCode); } /* Discard event if not for current sharingId */ if (InitiateGeolocSharing.this.mSharingId == null || !InitiateGeolocSharing.this.mSharingId.equals(sharingId)) { return; } final String _state = RiApplication.sGeolocSharingStates[state.toInt()]; final String _reasonCode = RiApplication.sGeolocReasonCodes[reasonCode.toInt()]; mHandler.post(new Runnable() { public void run() { TextView statusView = (TextView) findViewById(R.id.progress_status); switch (state) { case STARTED: // Display session status statusView.setText(_state); break; case ABORTED: showMessageThenExit(getString(R.string.label_sharing_aborted, _reasonCode)); break; case REJECTED: showMessageThenExit(getString(R.string.label_sharing_rejected, _reasonCode)); break; case FAILED: showMessageThenExit(getString(R.string.label_sharing_failed, _reasonCode)); break; case TRANSFERRED: /* Display transfer progress */ statusView.setText(_state); /* Make sure progress bar is at the end */ ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar); progressBar.setProgress(progressBar.getMax()); ShowGeoloc.ShowGeolocForContact(InitiateGeolocSharing.this, contact, mGeoloc); break; default: statusView.setText(getString(R.string.label_gsh_state_changed, _state, _reasonCode)); } } }); } @Override public void onDeleted(ContactId contact, Set<String> sharingIds) { if (LogUtils.isActive) { Log.w(LOGTAG, "onDeleted contact=" + contact + " sharingIds=" + sharingIds); } } }; }
From source file:com.abcvoipsip.ui.calllog.CallLogListFragment.java
@Override public void placeCall(String number, Long accId) { if (!TextUtils.isEmpty(number)) { Intent it = new Intent(Intent.ACTION_CALL); it.setData(Uri.fromParts("csip", SipUri.getCanonicalSipContact(number, false), null)); it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (accId != null) { it.putExtra(SipProfile.FIELD_ACC_ID, accId); }/* w w w . j a va2 s .c om*/ getActivity().startActivity(it); } }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
@Override public void placeCall(String number, Long accId) { if (!TextUtils.isEmpty(number)) { Intent it = new Intent(Intent.ACTION_CALL); it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, SipUri.getCanonicalSipContact(number, false))); it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (accId != null) { it.putExtra(SipProfile.FIELD_ACC_ID, accId); }//from w w w . j av a2s.co m getActivity().startActivity(it); } }
From source file:ca.ualberta.cs.drivr.RequestsListAdapter.java
/** * Called when the view holder is wants to bind the request at a certain position in the list. * @param viewHolder/*w w w.ja v a2 s. c om*/ * @param position */ @Override public void onBindViewHolder(final RequestsListAdapter.ViewHolder viewHolder, final int position) { final Request request = requestsToDisplay.get(position); // Get the views to update final TextView otherUserNameTextView = viewHolder.otherUserNameTextView; final TextView descriptionTextView = viewHolder.descriptionTextView; final TextView fareTextView = viewHolder.fareTextView; final TextView routeTextView = viewHolder.routeTextView; final TextView statusTextView = viewHolder.statusTextView; final ImageView callImageView = viewHolder.callImageView; final ImageView emailImageView = viewHolder.emailImageView; final ImageView checkImageView = viewHolder.checkMarkImageView; final ImageView deleteImageView = viewHolder.xMarkImageView; // Todo Hide Image Views until correct Request State if (request.getRequestState() != RequestState.CONFIRMED) { checkImageView.setVisibility(View.INVISIBLE); } if (request.getRequestState() != RequestState.PENDING) { deleteImageView.setVisibility(View.INVISIBLE); } // Show the other person's name final DriversList drivers = request.getDrivers(); // Get the username of the other user if (userManager.getUserMode() == UserMode.RIDER) { final String multipleDrivers = "Multiple Drivers Accepted"; final String driverUsername = drivers.size() == 1 ? drivers.get(0).getUsername() : "No Driver Yet"; otherUserNameTextView.setText(drivers.size() > 1 ? multipleDrivers : driverUsername); } else { otherUserNameTextView.setText(request.getRider().getUsername()); } // If the request has a description, show it. Otherwise, hide te description if (Strings.isNullOrEmpty(request.getDescription())) descriptionTextView.setVisibility(View.GONE); else descriptionTextView.setText(request.getDescription()); // Show the fare fareTextView.setText("$" + request.getFareString()); // Show the route routeTextView.setText(request.getRoute()); // Driver User otherUserNameTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String otherUsername = otherUserNameTextView.getText().toString(); // there exists drivers if (otherUsername != "No Driver Yet") { if (otherUsername != "Multiple Drivers Accepted") { Gson gson = new GsonBuilder().registerTypeAdapter(Uri.class, new UriSerializer()).create(); ElasticSearch elasticSearch = new ElasticSearch( UserManager.getInstance().getConnectivityManager()); User user = elasticSearch.loadUser(otherUsername); String driverString = gson.toJson(user, User.class); Intent intent = new Intent(context, DriverProfileActivity.class); intent.putExtra(DriverProfileActivity.DRIVER, driverString); context.startActivity(intent); } else { startMultipleDriverIntent(request); } } } }); routeTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Gson gson = new GsonBuilder().registerTypeAdapter(Uri.class, new UriSerializer()).create(); String requestString = gson.toJson(request, Request.class); Intent intent = new Intent(context, RequestActivity.class); intent.putExtra("UniqueID", "From_RequestListActivity"); intent.putExtra(RequestActivity.EXTRA_REQUEST, requestString); context.startActivity(intent); } }); // Show the status text statusTextView.setText(request.getRequestState().toString()); // Add a listener to the call image callImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (drivers.size() == 0) { Toast.makeText(context, "No driver number available at this time", Toast.LENGTH_SHORT).show(); } // Start Dialer else if (drivers.size() == 1) { Intent intent = new Intent(Intent.ACTION_CALL); String number; if (UserManager.getInstance().getUserMode().equals(UserMode.RIDER)) { number = drivers.get(0).getPhoneNumber(); } else { number = request.getRider().getPhoneNumber(); } number = "tel:" + number; intent.setData(Uri.parse(number)); if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { return; } context.startActivity(intent); } else { startMultipleDriverIntent(request); } } }); // Add a listener to the email image emailImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (drivers.size() == 0) { Toast.makeText(context, "No driver email available at this time", Toast.LENGTH_SHORT).show(); } //http://stackoverflow.com/questions/8701634/send-email-intent else if (drivers.size() == 1) { Intent intent = new Intent(); ComponentName emailApp = intent.resolveActivity(context.getPackageManager()); ComponentName unsupportedAction = ComponentName .unflattenFromString("com.android.fallback/.Fallback"); boolean hasEmailApp = emailApp != null && !emailApp.equals(unsupportedAction); String email; if (UserManager.getInstance().getUserMode().equals(UserMode.RIDER)) { email = drivers.get(0).getEmail(); } else { email = request.getRider().getEmail(); } String subject = "Drivr Request: " + request.getId(); String body = "Drivr user " + drivers.get(0).getUsername(); if (hasEmailApp) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + email)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, body); context.startActivity(Intent.createChooser(emailIntent, "Chooser Title")); } else { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", email, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, ""); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); context.startActivity(Intent.createChooser(emailIntent, "Send email...")); } } else { startMultipleDriverIntent(request); } } }); // Complete The Request checkImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, RequestCompletedActivity.class); intent.putExtra(RequestCompletedActivity.REQUEST_ID_EXTRA, request.getId()); context.startActivity(intent); } }); deleteImageView.setOnClickListener(new View.OnClickListener() { // Todo Delete the Request @Override public void onClick(View v) { v.getContext(); ElasticSearch elasticSearch = new ElasticSearch( (ConnectivityManager) v.getContext().getSystemService(Context.CONNECTIVITY_SERVICE)); elasticSearch.deleteRequest(request.getId()); UserManager userManager = UserManager.getInstance(); userManager.getRequestsList().removeById(request); userManager.notifyObservers(); requestsToDisplay.remove(request); notifyItemRemoved(viewHolder.getAdapterPosition()); } }); }
From source file:fr.project.mlignereux.cv.view.fragment.ContactFragment.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case CALL_PERMISSION: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + callNumber)); startActivity(callIntent);/* ww w .ja va 2s .c o m*/ } } } }