Android Open Source - HomeMovies Email Util






From Project

Back to project page HomeMovies.

License

The source code is released under:

MIT License

If you think the Android project HomeMovies listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package il.co.All4Students.homemovies.util.email;
/*from   w  w w.  ja  va 2  s  . com*/
import java.io.File;
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

/**
 * A generic class, handel's sending emails to recipients
 * 
 * @author Arkadi Yoskovitz
 * @date 2013-02-08
 */
public class EmailUtil {
  /**
   * The basic send email implementation, corently has a few constraints
   * 
   * @param context
   *            - the context from which we called this method this is needed
   *            inorder to integrate with the buildin sending via Intent
   *            option of the OS
   * @param emailTo
   *            - our email resipeant, currantly a single resipeant
   * @param emailCC
   *            - our email CC resipeant, currantly a single resipeant
   * @param emailSubject
   *            - the mail Title
   * @param emailText
   *            - the mail content
   * @param filePaths
   *            - used inorder to send an attachment, can recive more the one,
   */
  public static void sendEmail(Context context, String emailTo,
      String emailCC, String emailSubject, String emailText,
      List<String> filePaths) {
    final Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    emailIntent.setType("text/plain");
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { emailTo });
    emailIntent.putExtra(Intent.EXTRA_CC, new String[] { emailCC });
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, emailText);
    if (filePaths != null) {
      // has to be an ArrayList
      ArrayList<Uri> uris = new ArrayList<Uri>();
      // convert from paths to Android friendly Parcelable Uri's
      for (String file : filePaths) {
        File fileIn = new File(file);
        Uri u = Uri.fromFile(fileIn);
        uris.add(u);
      }
      emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    }
    context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
  }
}




Java Source Code List

il.co.All4Students.homemovies.OkCancelBar.java
il.co.All4Students.homemovies.ScreenEdit.java
il.co.All4Students.homemovies.ScreenGridDetail.java
il.co.All4Students.homemovies.ScreenGrid.java
il.co.All4Students.homemovies.ScreenMain.java
il.co.All4Students.homemovies.ScreenPreferences.java
il.co.All4Students.homemovies.ScreenWeb.java
il.co.All4Students.homemovies.app.AppConstants.java
il.co.All4Students.homemovies.app.ApplicationPreference.java
il.co.All4Students.homemovies.app.HomeProjectApplication.java
il.co.All4Students.homemovies.core.ItemCompareRTID.java
il.co.All4Students.homemovies.core.ItemCompareRank.java
il.co.All4Students.homemovies.core.ItemCompareSubject.java
il.co.All4Students.homemovies.core.Item.java
il.co.All4Students.homemovies.util.adapter.ItemListAdapter.java
il.co.All4Students.homemovies.util.adapter.ScreenGridAdapter.java
il.co.All4Students.homemovies.util.app.AppUtil.java
il.co.All4Students.homemovies.util.db.ItemsDbConstants.java
il.co.All4Students.homemovies.util.db.ItemsDbHelper.java
il.co.All4Students.homemovies.util.db.ItemsHandler.java
il.co.All4Students.homemovies.util.dialog.RankDialog.java
il.co.All4Students.homemovies.util.dialog.ShareDialog.java
il.co.All4Students.homemovies.util.email.EmailUtil.java
il.co.All4Students.homemovies.util.image.ExternalStorageLoader.java
il.co.All4Students.homemovies.util.imageWeb.FileCache.java
il.co.All4Students.homemovies.util.imageWeb.ImageLoader.java
il.co.All4Students.homemovies.util.imageWeb.MemoryCache.java
il.co.All4Students.homemovies.util.json.JSONHandler.java
il.co.All4Students.homemovies.util.json.JSONUtilWithTags.java
il.co.All4Students.homemovies.util.json.JSONUtil.java
il.co.All4Students.homemovies.util.log.db.LogDbConstants.java
il.co.All4Students.homemovies.util.log.db.LogDbHelper.java
il.co.All4Students.homemovies.util.log.db.LogHandler.java
il.co.All4Students.homemovies.util.log.util.AppLog.java