ANDROID: Cannot resolve method getSupportActionBar()
Your activity needs to extend ActionBarActivity (which provides getSupportActionBar).
you need to change Activity to ActionBarActivity
public class mainActivity extends ActionBarActivity
ActionBarActivity has been deprecated so please use the following
public class mainActivity extends AppCompatActivity