List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:de.geeksfactory.opacclient.frontend.AccountFragment.java
@Override public void accountSelected(Account account) { svAccount.setVisibility(View.GONE); unsupportedErrorView.setVisibility(View.GONE); answerErrorView.setVisibility(View.GONE); errorView.removeAllViews();/*from w ww .ja v a2 s. c o m*/ llLoading.setVisibility(View.VISIBLE); setRefreshing(false); supported = true; this.account = app.getAccount(); OpacApi api; try { api = app.getApi(); } catch (NullPointerException e) { e.printStackTrace(); return; } if (api != null && !app.getLibrary().isAccountSupported()) { supported = false; // Not supported with this api at all llLoading.setVisibility(View.GONE); unsupportedErrorView.setVisibility(View.VISIBLE); tvErrBodyU.setText(R.string.account_unsupported_api); btSend.setText(R.string.write_mail); btSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "info@opacapp.de" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Bibliothek " + app.getLibrary().getIdent()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.interested_to_help)); emailIntent.setType("text/plain"); startActivity(Intent.createChooser(emailIntent, getString(R.string.write_mail))); } }); } else if (account.getPassword() == null || account.getPassword().equals("null") || account.getPassword().equals("") || account.getName() == null || account.getName().equals("null") || account.getName().equals("")) { // No credentials entered llLoading.setVisibility(View.GONE); answerErrorView.setVisibility(View.VISIBLE); btPrefs.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AccountEditActivity.class); intent.putExtra(AccountEditActivity.EXTRA_ACCOUNT_ID, app.getAccount().getId()); startActivity(intent); } }); tvErrHeadA.setText(""); tvErrBodyA.setText(R.string.status_nouser); } else { // Supported Context ctx = getActivity() != null ? getActivity() : OpacClient.getEmergencyContext(); AccountDataSource adatasource = new AccountDataSource(ctx); adatasource.open(); refreshtime = adatasource.getCachedAccountDataTime(account); if (refreshtime > 0) { displaydata(adatasource.getCachedAccountData(account), true); if (System.currentTimeMillis() - refreshtime > MAX_CACHE_AGE) { refresh(); } } else { refresh(); } adatasource.close(); } }
From source file:com.example.linhdq.test.documents.viewing.single.DocumentActivity.java
void shareText() { String shareBody = getPlainDocumentText(); if (shareBody == null) { Toast.makeText(DocumentActivity.this, R.string.empty_document, Toast.LENGTH_LONG).show(); return;//from ww w. ja v a2 s .c o m } Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, R.string.share_subject); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_chooser_title))); }
From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java
public void shareRequest(View view) { Intent s = new Intent(android.content.Intent.ACTION_SEND); s.setType("text/plain"); if (CurrencyValue.isNullOrZero(_amount)) { s.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.bitcoin_address_title)); s.putExtra(Intent.EXTRA_TEXT, getBitcoinAddress()); startActivity(Intent.createChooser(s, getResources().getString(R.string.share_bitcoin_address))); } else {/* w w w . j av a 2 s . co m*/ s.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.payment_request)); s.putExtra(Intent.EXTRA_TEXT, getPaymentUri()); startActivity(Intent.createChooser(s, getResources().getString(R.string.share_payment_request))); } }
From source file:com.example.android.naradaonline.DatagramFragment.java
protected final void sendEmail(DatagramRequest data) { if (data.type != DatagramRequestType.SEND_EMAIL) { Log.w(TAG, "This datagram is actually of type " + data.type.name()); }// ww w .ja v a2s . c o m Log.i("Send email", ""); String[] TO = { data.mEmailTo }; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your Datagram"); emailIntent.putExtra(Intent.EXTRA_TEXT, data.mEmailBody); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); Log.i("Finished sending email...", ""); } catch (android.content.ActivityNotFoundException ex) { // Toast.makeText(MainActivity.this, // "There is no email client installed.", Toast.LENGTH_SHORT).show(); } }
From source file:com.metinkale.prayerapp.vakit.fragments.MainFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.notification: Fragment frag = getActivity().getSupportFragmentManager().findFragmentByTag("notPrefs"); if (frag == null) { ((Main) getActivity()).setFooterText("", false); getActivity().getSupportFragmentManager().beginTransaction() .add(R.id.fragContainer, NotificationPrefs.create(mTimes), "notPrefs") .commitAllowingStateLoss(); } else {// w w w .j a v a2s . c om ((Main) getActivity()).setFooterText(getString(R.string.monthly), true); getActivity().getSupportFragmentManager().beginTransaction().remove(frag).commitAllowingStateLoss(); } break; case R.id.export: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.export).setItems(new CharSequence[] { "CSV", "PDF" }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, final int which) { long minDate = 0; long maxDate = Long.MAX_VALUE; if (mTimes instanceof WebTimes) { minDate = ((WebTimes) mTimes).getFirstSyncedDay().toDateTimeAtCurrentTime() .getMillis(); maxDate = ((WebTimes) mTimes).getLastSyncedDay().toDateTimeAtCurrentTime() .getMillis(); } final LocalDate ld = LocalDate.now(); final long finalMaxDate = maxDate; DatePickerDialog dlg = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int y, int m, int d) { final LocalDate from = new LocalDate(y, m + 1, d); DatePickerDialog dlg = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int y, int m, int d) { final LocalDate to = new LocalDate(y, m + 1, d); try { export(which, from, to); } catch (IOException e) { e.printStackTrace(); Crashlytics.logException(e); Toast.makeText(getActivity(), R.string.error, Toast.LENGTH_SHORT).show(); } } }, ld.getYear(), ld.getMonthOfYear() - 1, ld.getDayOfMonth()); DateTime startDate = DateTime.now().withDate(y, m + 1, d); long start = startDate.getMillis(); dlg.getDatePicker().setMinDate(start); if (which == 1) dlg.getDatePicker().setMaxDate( Math.min(finalMaxDate, startDate.plusDays(31).getMillis())); else dlg.getDatePicker().setMaxDate(finalMaxDate); dlg.setTitle(R.string.to); dlg.show(); } }, ld.getYear(), ld.getMonthOfYear() - 1, ld.getDayOfMonth()); dlg.getDatePicker().setMinDate(minDate); dlg.getDatePicker().setMaxDate(maxDate); dlg.setTitle(R.string.from); dlg.show(); } }); builder.show(); break; case R.id.refresh: if (mTimes instanceof WebTimes) { ((WebTimes) mTimes).syncAsync(); } break; case R.id.share: String txt = getString(R.string.shareTimes, mTimes.getName()) + ":"; LocalDate date = LocalDate.now(); String[] times = { mTimes.getTime(date, 0), mTimes.getTime(date, 1), mTimes.getTime(date, 2), mTimes.getTime(date, 3), mTimes.getTime(date, 4), mTimes.getTime(date, 5) }; for (int i = 0; i < times.length; i++) { txt += "\n " + Vakit.getByIndex(i).getString() + ": " + times[i]; } Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name)); sharingIntent.putExtra(Intent.EXTRA_TEXT, txt); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share))); } return super.onOptionsItemSelected(item); }
From source file:com.polyvi.xface.extension.messaging.XMessagingExt.java
/** * ??Email//from w w w . j a va 2 s .c om * * @param addr * ? * @param body * ? * @param subject * ? * @return ? */ private void sendEmail(String addr, String body, String subject) { String aEmailList[] = { addr }; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); mContext.startActivity(emailIntent); mCallbackContext.success(); }
From source file:com.klinker.android.theme_spotlight.activity.SpotlightActivity.java
public void onFeedbackClicked(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, "support@klinkerapps.com"); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name)); // create a chooser to handle the intent and attach a author startActivity(Intent.createChooser(intent, getString(R.string.send_feedback))); }
From source file:com.polyvi.xface.extension.XMessagingExt.java
/** * ??Email//from w w w .j a va 2s .com * @param addr ? * @param body ? * @param subject ? * @return ? */ private XExtensionResult sendEmail(String addr, String body, String subject) { String aEmailList[] = { addr }; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); getContext().startActivity(emailIntent); return new XExtensionResult(XExtensionResult.Status.OK, ""); }
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 ww . j av a2s. 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:com.cypress.cysmart.DataLoggerFragments.DataLoggerFragment.java
/** * Sharing the data logger txt file/*from w w w . ja v a 2s. c om*/ */ private void shareDataLoggerFile() { HomePageActivity.containerView.invalidate(); Intent emailIntent = new Intent(Intent.ACTION_SEND); // set the type to 'email' emailIntent.setType("vnd.android.cursor.dir/email"); emailIntent.putExtra(Intent.EXTRA_EMAIL, ""); // the attachment emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(mFilepath))); // the mail subject emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Data Logger File"); startActivity(Intent.createChooser(emailIntent, "Send email...")); }