インターネットで検索しましたが、良いものが見つかりませんでした。
そこで、この問題を解決する方法を見つけようとしました。見つけたのですが、これはあまりにも汚い解決策ですか、使用されているか、危険ですか?
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
public class MyActivity extends Activity implements OnClickListener {
   public void onCreate(Bundle b) {
      new AlertDialog.Builder(this)
         .setTitle("Title1")
         .setPositiveBUtton("Ok",this)
         .show();
      new AlertDialog.Builder(this)
         .setTitle("Title2")
         .setPositiveButton("Ok",this)
         .show();
   }
   @Override
   public void onClick(DialogInterface dialog, int id) {
      String dialogTitle = ((AlertDialog)dialog).getActionBar().getTitle().toString();
      if(dialogTitle.equals("Title1")) {
         switch(id) {
            //do smth
         }
      } else if(dialogTitle.equals("Title2")) {
         switch(id) {
            //do smth
         }
      } else {
         //no such dialog
      }
   }
}