You will be able to get another mortgage but you will have to wait at least 3 to 5 years, depending on the program that you use to obtain your new mortgage.
With having that time till you are able to get another mortgage you will be able to work on getting your credit scores up by re-establishing your credit with new small loans and small balance credit cards. Making your payments on time every month is going to be on of the important keys to re-establishing your credit and keeping your credit card balances down to around 40% of your available credit.