9
我通過WhatsApp分享我的圖片 - 但我必須選擇收件人。 這裏是我的代碼:通過WhatsApp發送圖像到特定收件人(Android)
public static void shareImage(Context context,String path, String text, String otherAppPackage){
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
share.setPackage("com.whatsapp");
share.putExtra(android.content.Intent.EXTRA_SUBJECT, getSubject(context));
if (text!=null){
share.putExtra(Intent.EXTRA_TEXT,text);
}
if (path!=null){
share.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(new File(path)));
}
context.startActivity(Intent.createChooser(share, context.getString(R.string.share_via)));
}
我爾德喜歡與人直接交流。你們有些人知道我該怎麼做? 感謝
[通過WhatsApp的發送消息]的可能重複(http://stackoverflow.com/questions/15462874/sending- message-through-whatsapp) – rds
發現了什麼? –