i'm not sure what is wrong with my code, i'm thinking it's relate to dialog.dismiss, but maybe i'm wrong... i'm trying to set a dialog and when the user press ok, an email will be sent to some email. here's the code:
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.send_dialog);
dialog.setTitle(R.string.send_dialog_title);
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
final EditText nameField = (EditText) findViewById(R.id.DialogEditTextName);
String name = nameField.getText().toString();
final EditText commentField = (EditText) findViewById(R.id.DialogEditTextComments);
String comment = commentField.getText().toString();
Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setType("image/*");
sendIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] { "origameapp@gmail.com" });
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Picture for Facebook page");
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT,"NAME:"+name+". "+comment);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filepath[position])) );
startActivity(Intent.createChooser(sendIntent, "Send your picture with:"));
}
});
dialog.show();