public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } /** * increase score team 1 point. */ public void addoneforteama(view v) { displayforteama(1); } /** * increase score team 2 points. */ public void addtwoforteama(view v) { displayforteama(2); } /** * increase score team 3 points. */ public void addthreeforteama(view v) { displayforteama(3); } /** * displays given score team a. */ public void displayforteama(int score) { textview scoreview = (textview) findviewbyid(r.id.team_a_score); scoreview.settext(string.valueof(score)); } }
these 2 errors getting please me solve them. these lines of code actualyy copied fromgithub udacity android beginer code
error:(21, 36) error: cannot find symbol variable menu
error:(33, 23) error: cannot find symbol variable action_settings
it means missing variables id menu , action_settings in resources/menu folder.
Comments
Post a Comment