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.pacoapp.paco.ui.FindExperimentsActivity.java
private void launchEmailPacoTeam() { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { getString(R.string.contact_email) }; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.email_subject_paco_feedback)); emailIntent.setType("plain/text"); startActivity(emailIntent);/*from ww w . j a va2s . c o m*/ }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { getActivity().finish();// ww w . j a v a 2 s . c o m return true; } case R.id.AddLog: { try { addMessageDialog = new Dialog(getActivity()); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText() .toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "AddLog", e); return false; } } case R.id.escalate: { try { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + Title.getText()); String EventDetails = Summary.getText() + "\r\r\n" + LastTime.getText() + "\r\r\n" + "Count: " + EventCount.getText(); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "escalate", e); return false; } } default: { return false; } } }
From source file:com.crossconnect.activity.notemanager.NoteManagerBibleNotesFragment.java
@Override public void onListItemClick(ListView l, View v, int pos, long id) { final int position = pos; //Get the corresponding resource final Note note = mAdapter.getItem(position); final ActionItem openAction = new ActionItem(); openAction.setTitle("Open"); openAction.setIcon(getResources().getDrawable(R.drawable.ic_action_search)); final ActionItem deleteAction = new ActionItem(); deleteAction.setTitle("Delete"); deleteAction.setIcon(getResources().getDrawable(R.drawable.ic_action_delete)); final ActionItem shareAction = new ActionItem(); shareAction.setTitle("Share"); shareAction.setIcon(getResources().getDrawable(R.drawable.ic_action_share)); final QuickActionHorizontal mQuickAction = new QuickActionHorizontal(v); final String text = "blah"; openAction.setOnClickListener(new OnClickListener() { @Override//from w w w . j a v a 2s . c o m public void onClick(View v) { Log.d(TAG, "Opening Notes:" + note.getBook() + " " + note.getChapter()); //Open the note Intent i = new Intent(); BibleText bibleText = new SwordBibleText(note.getBook(), note.getChapter(), getActivity().getIntent().getExtras().getString("Translation")); SwordContentFacade.getInstance().injectChapterFromJsword(bibleText); i.putExtra("BibleText", bibleText); getActivity().setResult(Activity.RESULT_OK, i); getActivity().finish(); mQuickAction.dismiss(); } }); deleteAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { BibleText bibleText = new SwordBibleText(note.getBook(), note.getChapter(), getActivity().getIntent().getExtras().getString("Translation")); //TODO: should use this ID instead of key but will do for now need TABLE change //notesService.removeNote(note.getId()); notesService.removeNote(bibleText.getKey()); getLoaderManager().restartLoader(0, null, NoteManagerBibleNotesFragment.this); mAdapter.notifyDataSetChanged(); mQuickAction.dismiss(); } }); //Check the links are actually there mQuickAction.addActionItem(openAction); mQuickAction.addActionItem(deleteAction); shareAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String text = note.getText(); Toast.makeText(getActivity(), "Share " + text, Toast.LENGTH_SHORT).show(); Intent sendMailIntent = new Intent(Intent.ACTION_SEND); sendMailIntent.putExtra(Intent.EXTRA_SUBJECT, "CrossConnect Bible Verse"); sendMailIntent.putExtra(Intent.EXTRA_TEXT, text + " (" + note.getBook() + ":" + note.getChapter() + ")"); sendMailIntent.setType("text/plain"); getActivity().startActivity(Intent.createChooser(sendMailIntent, "Share using...")); mQuickAction.dismiss(); } }); mQuickAction.addActionItem(shareAction); mQuickAction.setAnimStyle(QuickActionVertical.ANIM_AUTO); mQuickAction.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { } }); mQuickAction.show(); Log.i(TAG, "Item clicked: " + id); }
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
private void openFeedback() { String feedbackMail = (String) getText(R.string.mail_feedback); String feedback = getText(R.string.drawer_feedback) + " - android v" + BuildConfig.VERSION_NAME; Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, feedback); intent.setData(Uri.parse(feedbackMail)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);// w w w . j a va 2 s. co m }
From source file:com.microsoft.mimickeralarm.ringing.ShareFragment.java
public void share() { Loggable.UserAction userAction = new Loggable.UserAction(Loggable.Key.ACTION_SHARE); Logger.track(userAction);//from w w w. j a v a 2 s . co m mCallback.onRequestLaunchShareAction(); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); // this causes issues with gmail //shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); File file = new File(mShareableUri); Uri uri = Uri.fromFile(file); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.share_text_template)); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.share_subject_template)); shareIntent.setType("image/*"); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); startActivityForResult( Intent.createChooser(shareIntent, getResources().getString(R.string.share_action_description)), SHARE_REQUEST_CODE); }
From source file:com.mbientlab.metawear.app.SensorFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); chart = (LineChart) view.findViewById(R.id.data_chart); initializeChart();/*from w w w. ja va 2s.c o m*/ resetData(false); chart.invalidate(); view.findViewById(R.id.data_clear).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { chart.resetTracking(); chart.clear(); resetData(true); chart.invalidate(); } }); ((Switch) view.findViewById(R.id.sample_control)) .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { moveViewToLast(); setup(); chartHandler.postDelayed(updateChartTask, UPDATE_PERIOD); } else { chart.setVisibleXRangeMaximum(sampleCount); clean(); if (streamRouteManager != null) { streamRouteManager.remove(); streamRouteManager = null; } chartHandler.removeCallbacks(updateChartTask); } } }); view.findViewById(R.id.data_save).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String filename = saveData(); if (filename != null) { File dataFile = getActivity().getFileStreamPath(filename); Uri contentUri = FileProvider.getUriForFile(getActivity(), "com.mbientlab.metawear.app.fileprovider", dataFile); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, filename); intent.putExtra(Intent.EXTRA_STREAM, contentUri); startActivity(Intent.createChooser(intent, "Saving Data")); } } }); }
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);/* w w w. j av a2s . co 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.chummy.jezebel.material.dark.activities.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; mPrefs = new Preferences(Main.this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from ww w . j a v a 2 s . c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); thaApp = getResources().getString(R.string.app_name); thaHome = getResources().getString(R.string.section_one); thaPreviews = getResources().getString(R.string.section_two); thaApply = getResources().getString(R.string.section_three); thaWalls = getResources().getString(R.string.section_four); thaRequest = getResources().getString(R.string.section_five); thaCredits = getResources().getString(R.string.section_seven); thaTesters = getResources().getString(R.string.section_eight); thaWhatIsThemed = getResources().getString(R.string.section_nine); thaContactUs = getResources().getString(R.string.section_ten); thaLogcat = getResources().getString(R.string.section_eleven); thaFAQ = getResources().getString(R.string.section_twelve); thaHelp = getResources().getString(R.string.section_thirteen); thaAbout = getResources().getString(R.string.section_fourteen); thaIconPack = getResources().getString(R.string.section_fifteen); thaFullChangelog = getResources().getString(R.string.section_sixteen); thaRebuild = getResources().getString(R.string.section_seventeen); drawerVersion = getResources().getString(R.string.version_code); currentItem = 1; headerResult = new AccountHeader().withActivity(this).withHeaderBackground(R.drawable.header) .withSelectionFirstLine(getResources().getString(R.string.app_name)) .withSelectionSecondLine(drawerVersion).withSavedInstance(savedInstanceState).withHeightDp(120) .build(); enable_features = mPrefs.isFeaturesEnabled(); firstrun = mPrefs.isFirstRun(); result = new Drawer().withActivity(this).withToolbar(toolbar).withAccountHeader(headerResult) .withHeaderDivider(false).withDrawerWidthDp(400) .addDrawerItems(new SectionDrawerItem().withName("Main"), new PrimaryDrawerItem().withName(thaHome).withIcon(GoogleMaterial.Icon.gmd_home) .withIdentifier(1), new PrimaryDrawerItem().withName(thaIconPack) .withIcon(GoogleMaterial.Icon.gmd_picture_in_picture) .withDescription("This applies icon pack 'Whicons'.").withCheckable(false) .withIdentifier(11), new PrimaryDrawerItem().withName(thaFullChangelog) .withIcon(GoogleMaterial.Icon.gmd_wrap_text) .withDescription("Complete changelog of Dark Material.").withCheckable(false) .withIdentifier(12), new DividerDrawerItem(), new SectionDrawerItem().withName("Information"), new PrimaryDrawerItem().withName(thaAbout).withIcon(GoogleMaterial.Icon.gmd_info_outline) .withDescription("Basic information on the theme.").withIdentifier(10), new PrimaryDrawerItem().withName(thaWhatIsThemed).withIcon(GoogleMaterial.Icon.gmd_warning) .withDescription("List of overlaid applications.").withIdentifier(3), new PrimaryDrawerItem().withName(thaFAQ).withIcon(GoogleMaterial.Icon.gmd_question_answer) .withDescription("Common questions with answers.").withIdentifier(8), new DividerDrawerItem(), new SectionDrawerItem().withName("Tools & Utilities"), new PrimaryDrawerItem().withName(thaRebuild).withIcon(GoogleMaterial.Icon.gmd_sync) .withDescription("A rebuild a day keeps the RRs away!").withCheckable(false) .withBadge("ROOT ").withIdentifier(13), new PrimaryDrawerItem().withName(thaLogcat).withIcon(GoogleMaterial.Icon.gmd_bug_report) .withDescription("System level log recording.").withCheckable(false) .withBadge("ROOT ").withIdentifier(7), new DividerDrawerItem(), new SectionDrawerItem().withName("The Developers"), new PrimaryDrawerItem().withName(thaCredits).withIcon(GoogleMaterial.Icon.gmd_people) .withDescription("chummy development team").withIdentifier(5), new PrimaryDrawerItem().withName(thaTesters).withIcon(GoogleMaterial.Icon.gmd_star) .withDescription("The people who keep the team updated.").withIdentifier(4), new DividerDrawerItem(), new SectionDrawerItem().withName("Contact"), new SecondaryDrawerItem().withName(thaContactUs).withIcon(GoogleMaterial.Icon.gmd_mail) .withCheckable(false).withIdentifier(6), new SecondaryDrawerItem().withName(thaHelp).withIcon(GoogleMaterial.Icon.gmd_help) .withCheckable(true).withIdentifier(9)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { if (drawerItem != null) { switch (drawerItem.getIdentifier()) { case 1: switchFragment(1, thaApp, "Home"); break; case 2: ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); if (isConnected) { switchFragment(2, thaWalls, "Wallpapers"); } else { showNotConnectedDialog(); } break; case 3: switchFragment(3, thaWhatIsThemed, "WhatIsThemed"); break; case 4: switchFragment(4, thaTesters, "Testers"); break; case 5: switchFragment(5, thaCredits, "Credits"); break; case 6: StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + getResources().getString(R.string.email_id))); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_rro)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cos)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cm)); } emailBuilder.append("\n \n \nOS Version: " + System.getProperty("os.version") + "(" + Build.VERSION.INCREMENTAL + ")"); emailBuilder.append("\nOS API Level: " + Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ") " + "[" + Build.ID + "]"); emailBuilder.append("\nDevice: " + Build.DEVICE); emailBuilder.append("\nManufacturer: " + Build.MANUFACTURER); emailBuilder.append( "\nModel (and Product): " + Build.MODEL + " (" + Build.PRODUCT + ")"); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { emailBuilder.append("\nTheme Engine: Not Available"); } else { emailBuilder.append("\nTheme Engine: Layers Manager (RRO)"); } } else { emailBuilder.append("\nTheme Engine: Cyanogen OS Theme Engine"); } } else { emailBuilder.append("\nTheme Engine: CyanogenMod Theme Engine"); } PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } emailBuilder.append("\nApp Version Name: " + appInfo.versionName); emailBuilder.append("\nApp Version Code: " + appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); break; case 7: if (Shell.SU.available()) { if (!isAppInstalled("com.tooleap.logcat")) { if (!isAppInstalled("com.nolanlawson.logcat")) { Intent logcat = new Intent(Intent.ACTION_VIEW, Uri.parse( getResources().getString(R.string.play_store_link_logcat))); startActivity(logcat); } else { Intent intent_logcat = getPackageManager() .getLaunchIntentForPackage("com.nolanlawson.logcat"); Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(R.string.logcat_toast), Toast.LENGTH_LONG); toast.show(); startActivity(intent_logcat); } } else { Intent intent_tooleap = getPackageManager() .getLaunchIntentForPackage("com.tooleap.logcat"); Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(R.string.logcat_toast), Toast.LENGTH_LONG); toast.show(); startActivity(intent_tooleap); } } else { Toast toast = Toast.makeText(getApplicationContext(), "Unfortunately, this feature is only available for root users.", Toast.LENGTH_LONG); toast.show(); } break; case 8: switchFragment(8, thaFAQ, "FAQ"); break; case 9: switchFragment(9, thaHelp, "Help"); break; case 10: switchFragment(10, thaAbout, "About"); break; case 11: Intent launch_whicons = new Intent("android.intent.action.MAIN"); launch_whicons.setComponent(new ComponentName("org.cyanogenmod.theme.chooser", "org.cyanogenmod.theme.chooser.ChooserActivity")); launch_whicons.putExtra("pkgName", "com.whicons.iconpack"); Intent launch_whicons_cos = new Intent("android.intent.action.MAIN"); launch_whicons_cos.setComponent(new ComponentName("com.cyngn.theme.chooser", "com.cyngn.theme.chooser.ChooserActivity")); launch_whicons_cos.putExtra("pkgName", "com.whicons.iconpack"); Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.play_store_whicons))); Intent intent_whicons = getPackageManager() .getLaunchIntentForPackage("com.whicons.iconpack"); if (intent_whicons == null) { startActivity(devPlay); } else { if (isAppInstalled("org.cyanogenmod.theme.chooser")) { startActivity(launch_whicons); } else { if (isAppInstalled("com.cyngn.theme.chooser")) { Toast toast = Toast.makeText(getApplicationContext(), "Select Dark Material, click Customize and locate Default Icons. Then select Whicons and click Apply.", Toast.LENGTH_LONG); toast.show(); startActivity(launch_whicons_cos); } else { startActivity(intent_whicons); } } } break; case 12: fullchangelog(); break; case 13: if (Shell.SU.available()) { rebuildThemeCache(); } else { Toast toast = Toast.makeText(getApplicationContext(), "Unfortunately, this feature is only available for root users.", Toast.LENGTH_LONG); toast.show(); } break; } } } }).withSavedInstance(savedInstanceState).build(); result.getListView().setVerticalScrollBarEnabled(false); // Check for permissions first so that we don't have any issues down the road int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck == PackageManager.PERMISSION_GRANTED) { // permission already granted, allow the program to continue running runLicenseChecker(); } else { // permission not granted, request it from the user ActivityCompat.requestPermissions(this, new String[] { android.Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } if (savedInstanceState == null) { result.setSelectionByIdentifier(1); } }
From source file:co.tinode.tindroid.ContactsFragment.java
private void handleItemClick(final ContactsAdapter.ViewHolder tag) { boolean done = false; if (mPhEmImData != null) { Utils.ContactHolder holder = mPhEmImData.get(tag.contact_id); if (holder != null) { String address = holder.getIm(); if (address != null) { Intent it = new Intent(getActivity(), MessageActivity.class); it.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); it.putExtra("topic", address); startActivity(it);// ww w .j a v a 2 s. com done = true; } if (!done && ((address = holder.getPhone()) != null)) { // Send an SMS with an invitation Uri uri = Uri.fromParts("smsto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", getString(R.string.tinode_invite_body)); startActivity(it); done = true; } if (!done && ((address = holder.getEmail()) != null)) { Uri uri = Uri.fromParts("mailto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.tinode_invite_subject)); it.putExtra(Intent.EXTRA_TEXT, getString(R.string.tinode_invite_body)); startActivity(it); done = true; } } } if (!done) { Toast.makeText(getContext(), R.string.failed_to_invite, Toast.LENGTH_SHORT).show(); } }
From source file:in.shick.diode.submit.SubmitLinkActivity.java
private boolean defaultExtractProperties(Bundle extras, SubmissionProperties properties) { if (null == extras) { return false; }//from w w w. j a va 2 s .c o m String url = extras.getString(Intent.EXTRA_TEXT); String title = extras.getString(Intent.EXTRA_SUBJECT); if ((null == url) || (null == title)) { return false; } try { new URL(url); } catch (MalformedURLException e) { return false; } properties.url = url; properties.title = title; return true; }