How to check if microphone is available on Android device?

I’m working on an app that has an optional feature - recording audio. It’s not required though…

And I’d like to check if it’s possible to record audio (to see if there’s an microphone at all) to hide the “record sound” button if there’s no way to record it.

Any way I can do it?