Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PLAIN_TEXT_TYPE issue

Tags:

android

I am having and issue with the line "emailIntent.setType(HTTP.PLAIN_TEXT_TYPE);" as it says cannot resolve issue for the PLAIN_TEXT_TYPE part. I am working through this: https://developer.android.com/training/basics/intents/sending.html and kept the code the same.

enter image description here

like image 707
fergus Avatar asked Mar 04 '26 00:03

fergus


1 Answers

setType takes a String so you can circumvent it (as it says in the comment) by doing this:

 emailIntent.setType("text/plain");

I did a quick Google, looks like the docs made sense for Android v5 but not since then :-) aka above Marshmallow. HTTP.PLAIN_TEXT_TYPE is apart of apache http which used to be bundled with Android. What code do I need to fix Apache HTTP Client removal? TLDR just use the String as above.

https://developer.android.com/about/versions/marshmallow/android-6.0-changes#behavior-apache-http-client


Raised a bug for them to fix the docs: https://issuetracker.google.com/issues/148429148 :-)

like image 189
Blundell Avatar answered Mar 06 '26 14:03

Blundell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!