From f9bb067e54d3ae520f70f60f1f91ae7442eb9c31 Mon Sep 17 00:00:00 2001 From: "thien.thai" Date: Mon, 14 Sep 2015 12:00:21 +0700 Subject: [PATCH] intent type text plain --- .idea/misc.xml | 2 +- .../com/hahattpro/meowdebughelperdemo/MainActivity.java | 4 ++-- .../main/java/com/hahattpro/meowdebughelper/Mailer.java | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 71fc700..e8eaafe 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/com/hahattpro/meowdebughelperdemo/MainActivity.java b/app/src/main/java/com/hahattpro/meowdebughelperdemo/MainActivity.java index c84d42c..5ecea34 100644 --- a/app/src/main/java/com/hahattpro/meowdebughelperdemo/MainActivity.java +++ b/app/src/main/java/com/hahattpro/meowdebughelperdemo/MainActivity.java @@ -30,8 +30,8 @@ private void mailFromAssets(){ is = assetManager.open("winter_is_coming.jpg"); CreateTempFile tempFile = new CreateTempFile("winter_is_coming.jpg",is,MainActivity.this); File file = tempFile.getFile(); - Mailer mailer = new Mailer(this); - mailer.sendMail("testing.ttpro1995@yahoo.com.vn","winter_is_coming","meow meow",file); + + Mailer.send(MainActivity.this,"testing.ttpro1995@yahoo.com.vn", "winter_is_coming", "meow meow", file); }catch (IOException e){ e.printStackTrace(); } diff --git a/meowdebughelper/src/main/java/com/hahattpro/meowdebughelper/Mailer.java b/meowdebughelper/src/main/java/com/hahattpro/meowdebughelper/Mailer.java index 0d33148..aff8206 100644 --- a/meowdebughelper/src/main/java/com/hahattpro/meowdebughelper/Mailer.java +++ b/meowdebughelper/src/main/java/com/hahattpro/meowdebughelper/Mailer.java @@ -6,7 +6,8 @@ import android.support.annotation.Nullable; import android.util.Log; -import org.apache.http.protocol.HTTP; + + import java.io.File; @@ -25,7 +26,7 @@ public void sendMail(String to,String subject, String msg,@Nullable File file1){ Intent emailIntent = new Intent(Intent.ACTION_SEND); // The intent does not have a URI, so declare the "text/plain" MIME type - emailIntent.setType(HTTP.PLAIN_TEXT_TYPE); + emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to}); // recipients emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, msg); @@ -40,7 +41,7 @@ public static void send(Context context,String to,String subject, String msg,@Nu Intent emailIntent = new Intent(Intent.ACTION_SEND); // The intent does not have a URI, so declare the "text/plain" MIME type - emailIntent.setType(HTTP.PLAIN_TEXT_TYPE); + emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to}); // recipients emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, msg);