java - Automatically created MainActivity has errors -
i have started java , android programming , eclipse created mainacitivity me:
package com.dummies.android.lautlosmodus; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { @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.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(); if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
but can`t run because of error:
"r cannot resolved variable"
anyone got idea on how fix this?
add import com.dummies.android.lautlosmodus.r;
also, use appcompatactivity extended class. actionbaractivity deprecated.
Comments
Post a Comment