mime-types, why are they needed and what they do? Why are they used in queries? (lib okhttp)? These types are interested in …
headers.put (“Content-Type”, “Application / X-WWW-FORM-URLENCODED”);
Headers.put (“Content-Type”, “Application / JSON”);
Header (“User-Agent”, getUseragent ())
requestbody.create (“Text / X-Markdown; Charset = UTF-8”), Body);
“Application / OCTET-STREAM”
Answer 1, Authority 100%
It is better to read in detail on Wikipedia , although the answer is generally easy to google.
In essence, MIME types allow the browser (and maybe the programmer on the client side, or, as in your case, the Android application) to determine the title, which content type it will receive. That is, the browser immediately knows, wait for him an image or a simple text file.
For example, here, having received a MIME type of content, I can determine in the code that server response must be interpreted as an image.
connection.getContentType ()
if (contenttype.contains ("image")) {
Bitmap image;
image = bitmapfactory.decodestream (Connection.getInputStream ());
result.obj = image;
}