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:net.eledge.android.europeana.gui.activity.RecordActivity.java
private Intent createShareIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, recordController.getPortalUrl()); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Check out this item on Europeana.eu!"); return shareIntent; }
From source file:com.cleanwiz.applock.ui.activity.LockMainActivity.java
public void shareMsg(String activityTitle, String msgTitle, String msgText, String imgPath) { Intent intent = new Intent(Intent.ACTION_SEND); if (imgPath == null || imgPath.equals("")) { intent.setType("text/plain"); } else {/*from w ww. j a v a2s . c o m*/ File f = new File(imgPath); if (f.exists() && f.isFile()) { intent.setType("image/jpg"); Uri uri = Uri.fromFile(f); intent.putExtra(Intent.EXTRA_STREAM, uri); } } intent.putExtra(Intent.EXTRA_SUBJECT, msgTitle); intent.putExtra(Intent.EXTRA_TEXT, msgText); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, activityTitle)); }
From source file:com.gelakinetic.mtgfam.fragments.TradeFragment.java
/** * Build a plaintext trade and share it. *//*from w w w. j av a 2s . c o m*/ private void shareTrade() { StringBuilder sb = new StringBuilder(); /* Add all the cards to the StringBuilder from the left, tallying the price */ float totalPrice = 0; for (MtgCard card : mListLeft) { totalPrice += (card.toTradeShareString(sb, getString(R.string.wishlist_foil)) / 100.0f); } sb.append(String.format(Locale.US, PRICE_FORMAT + "%n", totalPrice)); /* Simple divider */ sb.append("--------\n"); /* Add all the cards to the StringBuilder from the right, tallying the price */ totalPrice = 0; for (MtgCard card : mListRight) { totalPrice += (card.toTradeShareString(sb, getString(R.string.wishlist_foil)) / 100.0f); } sb.append(String.format(Locale.US, PRICE_FORMAT, totalPrice)); /* Send the Intent on it's merry way */ Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, R.string.trade_share_title); sendIntent.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendIntent.setType("text/plain"); try { startActivity(Intent.createChooser(sendIntent, getString(R.string.trader_share))); } catch (android.content.ActivityNotFoundException ex) { ToastWrapper.makeAndShowText(getActivity(), R.string.error_no_email_client, ToastWrapper.LENGTH_SHORT); } }
From source file:com.google.zxing.client.android.result.ResultHandler.java
final void sendEmailFromUri(String uri, String email, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(uri)); if (email != null) { intent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); }/* w w w. j a v a2 s .c o m*/ putExtra(intent, Intent.EXTRA_SUBJECT, subject); putExtra(intent, Intent.EXTRA_TEXT, body); intent.setType("text/plain"); launchIntent(intent); }
From source file:com.hector.invoice.views.TabExportInvoiceOrder.java
@Override public void onClick(View v) { // TODO Auto-generated method stub if (v == btBack) { // return to main menu view this.onBackPressed(); } else if (v == btEmail) { String filelocation = ""; if (currentScreenIndex == Constants.TAB_EXPORT_RECHNUNG) { filelocation = ExternalStorage.getFilePDFPath(InvoiceInfo.getInstance().getAppContext()) .getAbsolutePath() + "/" + this.fileNamePDF_R; } else if (currentScreenIndex == Constants.TAB_EXPORT_LIEFERSCHEIN) { filelocation = ExternalStorage.getFilePDFPath(InvoiceInfo.getInstance().getAppContext()) .getAbsolutePath() + "/" + this.fileNamePDF_L; } else if (currentScreenIndex == Constants.TAB_EXPORT_ANGEBOT) { filelocation = ExternalStorage.getFilePDFPath(InvoiceInfo.getInstance().getAppContext()) .getAbsolutePath() + "/" + this.fileNamePDF_A; }/* ww w. j a v a2 s .co m*/ Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("application/pdf"); String to[] = new String[] { "@email.com" }; sharingIntent.putExtra(Intent.EXTRA_EMAIL, to); Uri uri = Uri.parse("file://" + filelocation); sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "subject"); startActivity(Intent.createChooser(sharingIntent, "Send email")); } }
From source file:com.silentcircle.silenttext.util.DeviceUtils.java
public static Intent getShareDebugInformationIntent(Context context) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", context.getString(R.string.support_email_address), null)); intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.support_email_subject)); intent.putExtra(Intent.EXTRA_TEXT, wrap(LABEL_DEBUG_INFO, getDebugInformation(context))); ResolveInfo info = context.getPackageManager().resolveActivity(intent, 0); if (info == null) { intent.setAction(Intent.ACTION_SEND); intent.setDataAndType(null, "text/plain"); }// w ww . j a va 2s .c o m return Intent.createChooser(intent, context.getString(R.string.share_with, context.getString(R.string.feedback))); }
From source file:it.mb.whatshare.MainActivity.java
private void onTellFriendsSelected() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(getResources().getString(R.string.email_body))); startActivity(Intent.createChooser(intent, getResources().getString(R.string.email_intent_msg))); }
From source file:com.agustinprats.myhrv.MainActivity.java
protected void sendFileByEmail(File file) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "eladfein@gmail.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Testing result of HRV bluetooth monitor"); intent.putExtra(Intent.EXTRA_TEXT, "see files attached"); Uri uri = Uri.fromFile(file);/*ww w . ja v a 2s. c om*/ intent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(intent, "Send email...")); }
From source file:com.first.akashshrivastava.showernow.ShowerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_shower_activity); /*Launching BootReceiver to test Intent playIntent = new Intent(getApplicationContext(), BootReceiver.class); startActivity(playIntent);//from w w w . j ava 2 s . c o m */ //Mobile ads initialization....The long number is the AdID, can be found on AdMob - ca-app-pub-8782530512283806/2988799979 MobileAds.initialize(getApplicationContext(), "ca-app-pub-8782530512283806/2988799979"); AdView mAdView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); //Facebook SDK initialization... FacebookSdk.sdkInitialize(getApplicationContext()); AppEventsLogger.activateApp(this); shareDialog = new ShareDialog(this); mDatabaseReference = FirebaseDatabase.getInstance().getReference(); mFirebaseAuth = FirebaseAuth.getInstance(); final ImageView genderImage = (ImageView) findViewById(R.id.imageGender); guyText = (TextView) findViewById(R.id.guyText); topText = (TextView) findViewById(R.id.textView2); SharedPreferences prefs = getSharedPreferences("myPrefs", Context.MODE_PRIVATE); extraAge = prefs.getInt("age", 0); extraFluffiness = prefs.getString("fluffiness", ""); extraGender = prefs.getString("gender", ""); extraOldTime = prefs.getLong("time", 0); extraSteps = prefs.getFloat("stepsBoot", 0); switch (extraGender) { case "male": genderImage.setImageResource(R.drawable.male_white_outline); break; case "female": genderImage.setImageResource(R.drawable.female_white_outline); break; case "other": genderImage.setImageResource(R.drawable.other_white_outline); break; } genderImage.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { //set alarm //Swith ccase switch (event.getAction()) { case MotionEvent.ACTION_UP: // PRESSED ..PRESSED if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.female_white_outline_pressed).getConstantState()) { genderImage.setImageResource(R.drawable.female_white_outline); } else if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.male_white_outline_pressed).getConstantState()) { genderImage.setImageResource(R.drawable.male_white_outline); } else if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.other_white_outline_pressed).getConstantState()) { genderImage.setImageResource(R.drawable.other_white_outline); } //Resets the wave after shower..this is not getting called for some reason.... waveProgressbar.setCurrent(0, ""); guyText.setText("0 %"); waveProgressbar.setVisibility(View.INVISIBLE); topText.setText("You have showered! \n When the wave hits 100% its time for your next shower "); if (fluffiness != null && gotSteps) { Calendar cal = Calendar.getInstance(); Intent activate = new Intent(ShowerActivity.this, AlarmReceiver.class); activate.putExtra("age", age); activate.putExtra("fluffiness", fluffiness); activate.putExtra("gender", gender); activate.putExtra("steps", steps); activate.putExtra("time", System.currentTimeMillis()); AlarmManager alarms; PendingIntent alarmIntent = PendingIntent.getBroadcast(ShowerActivity.this, 0, activate, FLAG_CANCEL_CURRENT); alarms = (AlarmManager) getSystemService(ALARM_SERVICE); alarms.cancel(alarmIntent); alarms.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis() + 5000, 1000 * 60, alarmIntent);//sets the alarm mDatabaseReference.child("User").child(mFirebaseAuth.getCurrentUser().getUid()) .child("Steps").setValue(steps);//sets old steps oldSteps = steps; mDatabaseReference.child("User").child(mFirebaseAuth.getCurrentUser().getUid()) .child("Time").setValue(System.currentTimeMillis()); oldTime = System.currentTimeMillis(); newUser = false; SharedPreferences sharedPref = getSharedPreferences("myPrefs", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("age", age); editor.putString("fluffiness", fluffiness); editor.putString("gender", gender); editor.putFloat("steps", steps); editor.putLong("time", System.currentTimeMillis()); editor.putFloat("stepsBoot", 0); editor.putBoolean("bootStart", true); editor.apply(); } else if (!gotSteps) { Toast.makeText(getApplicationContext(), "Waiting for steps", Toast.LENGTH_SHORT).show(); } return true; // if you want to handle the touch event case MotionEvent.ACTION_DOWN: // RELEASED..RELEASED.. if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.female_white_outline).getConstantState()) { genderImage.setImageResource(R.drawable.female_white_outline_pressed); } else if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.male_white_outline).getConstantState()) { genderImage.setImageResource(R.drawable.male_white_outline_pressed); } else if (genderImage.getDrawable().getConstantState() == getResources() .getDrawable(R.drawable.other_white_outline).getConstantState()) { genderImage.setImageResource(R.drawable.other_white_outline_pressed); } return true; // if you want to handle the touch event } //Switch case end bracket return false; } }); createWave(); setMenuColor(); setupStepcount(); setWaveHeight(); FloatingActionButton editDetails = (FloatingActionButton) findViewById(R.id.menu_item4); //edit user information. Goes to main activity editDetails.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { /* Fragment fragment = new Fragment(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(ShowerActivity.java); transaction.addToBackStack(ShowerActivity.java); transaction.commit(); */ //Fragment B at pos 2 should open when edit details is pressed.. Intent i = new Intent(ShowerActivity.this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } }); FloatingActionButton fabmenuDeleteAccount = (FloatingActionButton) findViewById(R.id.delete_Account); fabmenuDeleteAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog(); } }); FloatingActionButton fabMenuItem1 = (FloatingActionButton) findViewById(R.id.menu_item); fabMenuItem1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /*ComponentName receiver = new ComponentName(ShowerActivity.this, AlarmReceiver.class); // alarms.cancel(alarmIntent);?? PackageManager pm = ShowerActivity.this.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); stopService(new Intent(StepCountService.STEP_COUNT_SERVICE));*/ //mFirebaseAuth.getCurrentUser().getUid() =null; SharedPreferences sharedPref = getSharedPreferences("myPrefs", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("age", 0); editor.putString("fluffiness", ""); editor.putString("gender", ""); editor.putFloat("steps", 0); editor.putLong("time", 0); editor.putFloat("stepsBoot", 0); editor.putBoolean("bootStart", false); editor.apply(); Intent activate = new Intent(ShowerActivity.this, AlarmReceiver.class); PendingIntent alarmIntent = PendingIntent.getBroadcast(ShowerActivity.this, 0, activate, FLAG_CANCEL_CURRENT); AlarmManager alarms = (AlarmManager) getSystemService(ALARM_SERVICE); alarms.cancel(alarmIntent); stopService(new Intent(ShowerActivity.this, StepCountService.class)); mFirebaseAuth.getInstance().signOut(); Intent i = new Intent(ShowerActivity.this, LoginActivity.class); startActivity(i); } }); final FloatingActionButton shareButton = (FloatingActionButton) findViewById(R.id.shareButton); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); String shareBody = "Check out this showering app at: https://play.google.com/store/apps/details?id=com.first.akashshrivastava.showernow \n"; String shareSubString = "An app that tells you when you should shower and apparently keeps you clean"; shareIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubString); shareIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(shareIntent, " Share using the following")); } }); mDatabaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snap) { try { if ((!(mFirebaseAuth.getCurrentUser().getUid().isEmpty())) && snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("gender") .getValue().toString().equalsIgnoreCase("female")) { genderImage.setImageResource(R.drawable.female_white_outline); } else if (snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("gender") .getValue().toString().equalsIgnoreCase("male")) { genderImage.setImageResource(R.drawable.male_white_outline); } else if (snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("gender") .getValue().toString().equalsIgnoreCase("other")) { genderImage.setImageResource(R.drawable.other_white_outline); } } catch (Exception e) { e.printStackTrace(); } age = Integer.parseInt(snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()) .child("Age").getValue().toString());//gotta get int fluffiness = snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("gender") .getValue().toString(); gender = snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("gender") .getValue().toString(); if (snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("Time").exists()) { oldTime = snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("Time") .getValue(Long.class); oldSteps = snap.child("User").child(mFirebaseAuth.getCurrentUser().getUid()).child("Steps") .getValue(float.class); } else { newUser = true; } } @Override public void onCancelled(DatabaseError databaseError) { } }); }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java
public void handleExportTransactions() { // Create CSV file from transactions final File file = new File(Constants.Files.EXTERNAL_WALLET_BACKUP_DIR, Constants.Files.TX_EXPORT_NAME + "-" + getFileDate() + ".csv"); try {//from w ww . j a va 2s . c om final BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.append("Date,Label,Amount (" + MonetaryFormat.CODE_PPC + "),Fee (" + MonetaryFormat.CODE_PPC + "),Address,Transaction Hash,Confirmations\n"); if (txListAdapter == null || txListAdapter.transactions.isEmpty()) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed"); return; } final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm z"); dateFormat.setTimeZone(TimeZone.getDefault()); for (Transaction tx : txListAdapter.transactions) { TransactionsListAdapter.TransactionCacheEntry txCache = txListAdapter.getTxCache(tx); String memo = tx.getMemo() == null ? "" : StringEscapeUtils.escapeCsv(tx.getMemo()); String fee = tx.getFee() == null ? "" : tx.getFee().toPlainString(); String address = txCache.address == null ? getString(R.string.export_transactions_unknown) : txCache.address.toString(); writer.append(dateFormat.format(tx.getUpdateTime()) + ","); writer.append(memo + ","); writer.append(txCache.value.toPlainString() + ","); writer.append(fee + ","); writer.append(address + ","); writer.append(tx.getHash().toString() + ","); writer.append(tx.getConfidence().getDepthInBlocks() + "\n"); } writer.flush(); writer.close(); } catch (IOException x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); return; } final DialogBuilder dialog = new DialogBuilder(this); dialog.setMessage(Html.fromHtml(getString(R.string.export_transactions_dialog_success, file))); dialog.setPositiveButton(WholeStringBuilder.bold(getString(R.string.export_keys_dialog_button_archive)), new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_transactions_mail_subject)); intent.putExtra(Intent.EXTRA_TEXT, makeEmailText(getString(R.string.export_transactions_mail_text))); intent.setType(Constants.MIMETYPE_TX_EXPORT); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); try { startActivity(Intent.createChooser(intent, getString(R.string.export_transactions_mail_intent_chooser))); log.info("invoked chooser for exporting transactions"); } catch (final Exception x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); } } }); dialog.setNegativeButton(R.string.button_dismiss, null); dialog.show(); }