Code for Main Activity.