how para configurar un oyente onclick para un botón de imagen en un diálogo de alerta

Tengo un diseño con un ImageButton que se infla en un AlertDialog, ¿dónde / cómo debo configurar un oyente onClick?

Aquí está el código que intenté usar:

    ImageButton ib = (ImageButton) findViewById(R.id.searchbutton);
    ib.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(TravelBite.this, "test", Toast.LENGTH_SHORT).show();
        }
    });