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:com.desno365.mods.Activities.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case android.R.id.home: if (mNavigationDrawerFragment.isDrawerOpen()) MainNavigationDrawerFragment.mDrawerLayout.closeDrawer(findViewById(R.id.navigation_drawer)); else//from w w w .jav a2s . c o m MainNavigationDrawerFragment.mDrawerLayout.openDrawer(findViewById(R.id.navigation_drawer)); return true; case R.id.action_info: startActivity(new Intent(this, AboutActivity.class)); return true; case R.id.action_help: startActivity(new Intent(this, HelpActivity.class)); return true; case R.id.action_news: startActivity(new Intent(this, NewsActivity.class)); return true; case R.id.action_share: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.share_body)); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using))); DesnoUtils.sendAction(mTracker, "Share"); return true; case R.id.action_feedback: Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "desno365@gmail.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Desno365's Mods feedback"); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } DesnoUtils.sendAction(mTracker, "Feedback"); return true; case R.id.action_rate: final String appPackageName = getPackageName(); try { //play store installed startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { //play store not installed startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } DesnoUtils.sendAction(mTracker, "Rate-app"); return true; case R.id.action_settings: Intent intentSettings = new Intent(this, SettingsActivity.class); startActivity(intentSettings); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.apotheosis.acceleration.monitor.MainMenuActivity.java
private void setUpListView() { ListView lv = (ListView) findViewById(R.id.fileList); List<String> fileNames = FileUtilities.getFileList(); if (fileNames != null) { FileListAdapter listAdapter = new FileListAdapter(this); lv.setAdapter(listAdapter);/*from ww w.j a v a2s . c om*/ lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout); boolean isDrawerOpen = drawerLayout.isDrawerOpen(findViewById(R.id.side_drawer)); if (isDrawerOpen) drawerLayout.closeDrawers(); new LoadData(TimeXYZDataPackage.DataType.ACCELERATION, MainMenuActivity.this, parent.getAdapter().getItem(position).toString()).execute((Void[]) null); } }); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) { final String fileName = parent.getAdapter().getItem(position).toString(); final AlertDialog.Builder optionsMenu = new AlertDialog.Builder(MainMenuActivity.this); optionsMenu.setItems(new String[] { "Open Acceleration Graph", "Open Raw Data", "Share Data", "Delete Data", "Cancel" }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout); boolean isDrawerOpen = drawerLayout .isDrawerOpen(findViewById(R.id.side_drawer)); Intent i; Tracker tracker; switch (which) { case 0: dialog.dismiss(); if (isDrawerOpen) drawerLayout.closeDrawers(); new LoadData(TimeXYZDataPackage.DataType.ACCELERATION, MainMenuActivity.this, fileName).execute((Void[]) null); break; case 1: if (isDrawerOpen) drawerLayout.closeDrawers(); new LoadData(TimeXYZDataPackage.DataType.RAW_DATA, MainMenuActivity.this, fileName).execute((Void[]) null); break; case 2: if (isDrawerOpen) drawerLayout.closeDrawers(); tracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP); tracker.send(new HitBuilders.EventBuilder().setCategory("Data Function") .setAction("Share Data").build()); i = new Intent(Intent.ACTION_SEND); i.setType("text/xml"); i.putExtra(Intent.EXTRA_SUBJECT, "Sending " + fileName + "as attachment"); i.putExtra(Intent.EXTRA_TEXT, fileName + "is attached."); File f = new File(FileUtilities.path + fileName + ".csv"); i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); startActivity(Intent.createChooser(i, "Choose an application...")); break; case 3: final AlertDialog.Builder confirmDelete = new AlertDialog.Builder( MainMenuActivity.this); confirmDelete .setMessage("Are you sure you want to delete " + fileName + "?"); confirmDelete.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { File f = new File(FileUtilities.path + fileName + ".csv"); Log.d("DELETION_SUCESS", String.valueOf(f.delete())); setUpListView(); } }); confirmDelete.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); confirmDelete.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { dialog.dismiss(); } }); confirmDelete.show(); break; } } }); optionsMenu.show(); return true; } }); } }
From source file:com.denel.facepatrol.MainActivity.java
public void ContactEdit(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Contact Information Feedback") .setMessage("You're about to edit and send personal information. " + "Please note that the current database will only reflect your modification" + " once the IT department verifies the change and the updated database" + " is synced to your device. \n \n Do you want to continue?") .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "pkantue@gmail.com" }); // this email address will change emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); emailIntent.putExtra(Intent.EXTRA_SUBJECT, feedback_subject); emailIntent.putExtra(Intent.EXTRA_TEXT, feedback_body); startActivity(Intent.createChooser(emailIntent, "Send Email...")); }// www. j a v a2 s . co m }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.show(); // exit the application //finish(); }
From source file:com.gh4a.activities.IssueActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case R.id.issue_close: case R.id.issue_reopen: if (checkForAuthOrExit()) { new IssueOpenCloseTask(itemId == R.id.issue_reopen).schedule(); }/*from ww w . j av a 2 s .c om*/ return true; case R.id.share: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_issue_subject, mIssueNumber, mIssue.getTitle(), mRepoOwner + "/" + mRepoName)); shareIntent.putExtra(Intent.EXTRA_TEXT, mIssue.getHtmlUrl()); shareIntent = Intent.createChooser(shareIntent, getString(R.string.share_title)); startActivity(shareIntent); return true; } return super.onOptionsItemSelected(item); }
From source file:dk.dr.radio.data.DRData.java
public void kundividi(Activity akt) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Esperanto-radio por Androjd"); sendIntent.putExtra(Intent.EXTRA_TEXT, "Saluton!\n\n" + "Mi rekomendas ke vi elprovas tiun i programon per via Androjda telefono:\n" + "La Esperanto-radio de Muzaiko\n" + "https://market.android.com/details?id=dk.nordfalk.esperanto.radio\n" + "\n" + "Muzaiko estas Esperanto-radio kiu konstante elsendas.\n" + "Eblas anka askulti la lastatempajn elsendojn de deko da aliaj radistacioj." // +"\n\n(kaj... ne forgesu meti 5 stelojn :-)" );//from w ww . j a v a 2 s . c om sendIntent.setType("text/plain"); akt.startActivity(Intent.createChooser(sendIntent, "Sendi al")); }
From source file:com.androidinspain.deskclock.stopwatch.StopwatchFragment.java
/** * Send stopwatch time and lap times to an external sharing application. *//* www . j a v a 2 s . co m*/ private void doShare() { // Disable the fab buttons to avoid double-taps on the share button. updateFab(BUTTONS_DISABLE); final String[] subjects = getResources().getStringArray(R.array.sw_share_strings); final String subject = subjects[(int) (Math.random() * subjects.length)]; final String text = mLapsAdapter.getShareText(); @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") final Intent shareIntent = new Intent(Intent.ACTION_SEND) .addFlags(Utils.isLOrLater() ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) .putExtra(Intent.EXTRA_SUBJECT, subject).putExtra(Intent.EXTRA_TEXT, text).setType("text/plain"); final Context context = getActivity(); final String title = context.getString(R.string.sw_share_button); final Intent shareChooserIntent = Intent.createChooser(shareIntent, title); try { context.startActivity(shareChooserIntent); } catch (ActivityNotFoundException anfe) { LogUtils.e("Cannot share lap data because no suitable receiving Activity exists"); updateFab(BUTTONS_IMMEDIATE); } }
From source file:com.kopysoft.chronos.activities.ClockActivity.java
private void sendEmail() { //PayPeriodHolder payPeriodHolder, Job thisJob, Context context ProgressDialog dialog = ProgressDialog.show(ClockActivity.this, "", "Generating. Please wait..."); PayPeriodHolder pph;/* ww w .j a v a2 s. co m*/ if (getSupportActionBar().getSelectedTab().getPosition() == 0) { pph = new PayPeriodHolder(jobId); } else { pph = payHolder; } Email newEmail = new Email(pph, jobId, getApplicationContext()); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); int reportLevel = Integer.valueOf(pref.getString("reportLevel", "1")); String returnValue; if (reportLevel == 2) { returnValue = newEmail.getBriefView(); } else { returnValue = newEmail.getExpandedView(); } String emailBody = new String("Greetings!\n\tHere is my time card\n"); emailBody += returnValue; dialog.dismiss(); //Create email Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Time Card"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailBody); emailIntent.setType("message/rfc822"); startActivity(emailIntent); }
From source file:com.fbartnitzek.tasteemall.showentry.ShowReviewFragment.java
private void shareReview() { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType(getString(R.string.share_content_type)); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.share_empty_subject)); String shareBody = getString(R.string.share_review_text, mProducerNameView.getText().toString(), mDrinkNameView.getText().toString(), mReviewRatingView.getText().toString(), mReviewDescriptionView.getText().toString(), mReviewUserView.getText().toString(), mReviewReadableDateView.getText().toString()); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getString(R.string.choose_share_provider))); }
From source file:com.dmitrymalkovich.android.popularmoviesapp.details.MovieDetailFragment.java
private void updateShareActionProvider(Trailer trailer) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mMovie.getTitle()); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, trailer.getName() + ": " + trailer.getTrailerUrl()); mShareActionProvider.setShareIntent(sharingIntent); }