Facebook no aparece en las ventanas compartidas al intentar compartir una imagen
Creo un mapa de bits en mi aplicación y quiero compartirlo a través de aplicaciones de correo electrónico o Facebook mediante Intent.ACTION_SEND. la ventana de compartir se abre y aparece el ícono de las aplicaciones de gmail y yahoomail pero no hay facebook o g +! Realmente no sé cuál es el problema. Otro problema es que la aplicación gmail no puede adjuntar el archivo (creado a partir de un mapa de bits). Leí algunas preguntas similares, pero todavía estoy lleno. Ayudame por favor.
Aquí está mi código para compartir:
private static File writePhotoPng(Bitmap data, String pathName) {
File file = new File(pathName);
try {
file.createNewFile();
// BufferedOutputStream os = new BufferedOutputStream(
// new FileOutputStream(file));
FileOutputStream os = new FileOutputStream(file);
data.compress(Bitmap.CompressFormat.PNG, 100, os);
os.flush();
os.close();
} catch (Exception e) {
e.printStackTrace();
}
return file;
}
public static void ShareOnFb(Bitmap share, Activity activity, String emailSubject){
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
// EDIT:
// !!! childish mistake. below line is correct !!! intent.setType("Image/*");
intent.setType("image/*");
//add data to intent, the receiving app will decide what to do with it.
// email subject:
if (emailSubject != null && !emailSubject.equals("")){
intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
}
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(writePhotoPng(share, "temp.png")));
activity.startActivity(Intent.createChooser(intent, "Share on"));
}