我有用于发送whatsapp图像的代码,但它不会自动选择联系人。有人能看看我的代码,看看我做错了什么吗?谢谢
图像的onclick方法代码
public void onClick(View v) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) whatsapp.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
String bitmpath = MediaStore.Images.Media.insertImage(getContentResolver(),bitmap,"WhtasApp",null);
Uri uri = Uri.parse(bitmpath);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setPackage("com.whatsapp");
shareIntent.putExtra(Intent.EXTRA_STREAM,uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "" + txt_message.getText().toString());
EditText phonenum = (EditText) findViewById(R.id.txt_mobile);
EditText phonenum = (EditText) findViewById(R.id.txt_mobile);
PhoneNumberUtils.formatNumber(text.getText().toString())
shareIntent.putExtra("jid", PhoneNumberUtils.stripSeparators("")+"@s.whatsapp.net");
shareIntent.setType("text/plain");
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
startActivity(Intent.createChooser(shareIntent, "Share Image!"));
startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
}
}
暂无答案!
目前还没有任何答案,快来回答吧!