java - Why do I keep getting this error(cannot be resolved)? -
in 1 of classes getting error: game cannot resolved or not field, , when launch application says cannot open please try again, why keep getting error, there wrong r.java?
public class gameactivity extends activity { grid myview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); myview = new grid(this); myview.setgame(new game()); setcontentview(myview); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.game, menu);//error occurring here return true; }}
r.java
/* auto-generated file. not modify. * * class automatically generated * aapt tool resource data found. * should not modified hand. */ package com.example.applicationprogrammingassignment; public final class r { public static final class anim { public static final int slide_in_left=0x7f040000; public static final int slide_out_left=0x7f040001; } public static final class attr { } public static final class dimen { /** default screen margins, per android design guidelines. customize dimensions defined in res/values/dimens.xml (such screen margins) sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f050000; public static final int activity_vertical_margin=0x7f050001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f090003; public static final int btnhelp=0x7f090002; public static final int btnplay=0x7f090000; public static final int btnscore=0x7f090001; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f080000; } public static final class string { public static final int action_settings=0x7f060001; public static final int app_name=0x7f060000; public static final int hello_world=0x7f060002; } public static final class style { /** base application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. base application theme api 11+. theme replaces appbasetheme res/values/styles.xml on api 11+ devices. api 11 theme customizations can go here. base application theme api 14+. theme replaces appbasetheme both res/values/styles.xml , res/values-v11/styles.xml on api 14+ devices. api 14 theme customizations can go here. */ public static final int appbasetheme=0x7f070000; /** application theme. customizations not specific particular api-level can go here. */ public static final int apptheme=0x7f070001; } }
r.java compiled automatically each time modify resources in res
directory, not updated if there bug in 1 of xml files.
check xml files errors (lint should mark errors automatically). also, check 9 patches have make sure valid. can temporarily remove .9
name see if problem 9 patch format. have had cases of border pixels in 9 patch not pure black or pure white, , caused r.java not updated.
Comments
Post a Comment