Snippets

Small pieces of code that can be copy/paste-ed on your project

  1. Home
  2. chevron_right
  3. Snippets
  4. (Page 4)

Android HttpResponse content(body) to String

turned_in_not, , , ,
comment4 Comments
Usually I use the following code to convert a Http response content to String:   BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuilder responseBuilder = new StringBuilder(); String line = ""; while ((line = in.readLine()) != null) { responseBuilder.append(line); } in.close(); Log.e("WS…

Add image to email intent in Android

turned_in_not, , , ,
commentNo Comments
How to add image to an email intent in Android: // build a email sending intent Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("image/png"); // set the email subject emailIntent.putExtra(Intent.EXTRA_SUBJECT, "email subject"); // set the email image path for the attachment emailIntent.putExtra(Intent.EXTRA_STREAM,…
Menu