common code for Android