adapting code for Samsung Galaxy Tab 3 10.1