Android Question connecting to a wifi network by wifi ssid and password

Is it possible to connect to a wifi network if I have its ssid and password? (I mean if user inputs wifi ssid and its password using Edittext for example)
Besides, I actually want it to work in all version of Android especially Android 10. (I used to use MLWifi Library which is no longer support in android 9 and 10 (some of its functions are deprecated from SDK 27 and 28 and 29))