android notifier lorsque startActivity intention terminée?

J'ai besoin d'être en mesure de dire quand un donné naissance à l'activité (par le biais d'un but) a terminé, comment pourrais-je le faire?

C'est ce que j'ai:

    alertDialog.setButton2("Text", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String uri = "smsto:" + "";
            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
            intent.putExtra("sms_body", PASSWORD_GENERATOR
                    .generatePasswordForSeed(seedText, hourToUse));
            intent.putExtra("compose_mode", true);

            //-- open the text message activity
            startActivity(intent);

            //-- I need to reset the calling activity now, but AFTER the text message activity has completed. Right now the SMS closes right away as I have no wait in...
            finish();
            startActivity(getIntent());
        }
    });

EDIT #1

Par les suggestions ci-dessous, j'ai fait quelques modifications. Maintenant, cependant, l'lancé activité SMS juste "là" une fois que le texte est envoyé. Je ne peux pas comprendre comment le faire revenir à la vocation de l'activité. C'est ce que j'ai:

alertDialog.setButton2("Text", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String uri = "smsto:" + "";
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
intent.putExtra("sms_body", PASSWORD_GENERATOR
.generatePasswordForSeed(seedText, hourToUse));
intent.putExtra("compose_mode", true);
startActivityForResult(intent, Activity.RESULT_OK);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
finish();
startActivity(getIntent());
}
}, new IntentFilter("SMS_SENT"));
ContentResolver contentResolver = getContentResolver();
Handler handler = new Handler();
contentResolver.registerContentObserver(Uri
.parse("content://sms"), true, new ContentObserver(
handler) {
@Override
public boolean deliverSelfNotifications() {
setResult(Activity.RESULT_OK);
finish();
return super.deliverSelfNotifications();
}
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
setResult(Activity.RESULT_OK);
finish();
}
});
}
});
alertDialog.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
finish();
startActivity(getIntent());
}
  • hey, @javamonkey79 - comment c'était fini?
InformationsquelleAutor javamonkey79 | 2011-08-29