Added support for android 2.2+, fixed a bug that crashed the app when rotating screen