Directly you can not know whether or not there is a showing keyboard (there tricks on the Internet to calculate the size of the screen and subtract regarding the Activity, but not assure you that is a keyboard which reduce the size of the screen).
On the other hand, what we usually do in these cases is to change the position of Toast to come out top of the screen, so no problem with the keyboard.