code from nexus 7