Envío de texto e imágenes simultáneamente en android

En mi aplicación, Mi requisito es enviar imágenes y texto simultáneamente. Así que utilizo el código siguiente

Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/jpeg"); share.putExtra(Intent.EXTRA_TEXT, "My photos"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+f)); startActivity(Intent.createChooser(share, "Share Image")); 

Pero sólo se envía la imagen pero el texto no se envía. ¿Como puedó resolver esté problema?

intenta esto

// suponiendo uris es una lista de Uri

 Intent intent = null; if (uris.size > 1){ intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); } else if (uris.size() == 1) { intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));} intent.setType("image/*"); intent.putExtra(Intent.EXTRA_TEXT, "Some message"); startActivity(Intent.createChooser(intent,"compatible apps:")); 

Está configurando el MIME type de esa Intent de image , por eso sólo se envía la imagen. Algo así resuelve tu problema:

 Intent share = new Intent(Intent.ACTION_SEND); share.setType("*/*"); share.putExtra(Intent.EXTRA_TEXT, "My photos"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+f)); startActivity(Intent.createChooser(share, "Share Image")); 
 String message= "My photos"; URI = Uri.parse("file://" + f); Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("*/*"); if (URI != null) { share.putExtra(Intent.EXTRA_STREAM, URI); } share.putExtra(android.content.Intent.EXTRA_TEXT, message); startActivity(Intent.createChooser(share, "Share Image")); 

De esta manera debería estar bien.

  • La intención de compartir imágenes funciona para Gmail pero bloquea FB y twitter
  • ¿Cuál es el propósito de "FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET" al compartir?
  • Obtener excepción IndexOutOfBoundsException FragmentManagerImpl después de compartir algo con las aplicaciones
  • La imagen compartida de Android no funciona
  • EXCEPCIÓN FATAL: ThumbnailManager-1 mientras comparte imágenes con Intent
  • Problemas al compartir una imagen de activos en Android
  • La intención de compartir Google+ no puede acceder a la imagen
  • Compartir fotos con Android con FileProvider
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.