I want to make an AlertDialog with three buttons. Two of them work good but not the third one. The last button is a SharedIntent and shares the score of the user. I really don't know what causes the crash so here is my code : alert.setNeutralButton("Partager", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "text to share";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "text");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
});
Regards
Aucun commentaire:
Enregistrer un commentaire