0
ich eine App bin erstellen, wo ich Bilder und vedio in Social-Media-schicken apps facebook g + funktioniert einwand aber whatsapp und twitter funktionieren nicht ich diesen Code verwendenwhatsapp und Twitter ist keine Bilder in android app bekommen
Code ist für whatsapp
Button whtsapp_sahre = (Button)dialog.findViewById(R.id.whatsapp_btn);
whtsapp_sahre.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri imageUri = Uri.parse("android.resource://\" + getPackageName() + \"/drawable/pic8");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
//Target whatsapp:
shareIntent.setPackage("com.whatsapp");
//Add text and then Image URI
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello");
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try{
startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.whatsapp")));
}
}
});
und twitter-Code ist
Button _Twwiterbtn = (Button) dialog.findViewById(R.id.twwiter_btn);
_Twwiterbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM,R.drawable.pic8);
shareIntent.putExtra(Intent.EXTRA_TITLE,"HELLO status");
shareIntent.setType("image/*")
.setPackage("com.twitter.android");
try {
startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.twitter.android&hl=en")));
}
}
});
bitte helfen dank