Skip to content Skip to sidebar Skip to footer

How To Solve "itemtag Cannot Be Resolved Or Is Not A Field"?

In the strings.xml file, I have this: 12 But when I

Solution 1:

Check your java imports, you may have imported a R.java different to the one in your current package.

Remove all your imports then Ctrl+Shift+O (Organise imports) with Eclipse and chose the correct packages to import.

Solution 2:

If you're trying to get a String, then all R.string.itemTag is to the compiler is an int. If you look in the R class, you will find something like the following...

publicstaticclassstring {
    publicstaticint itemTag = 0x30000;
}

Along with all the other ids that you use. What you want to do is the following...

getResources().getString(R.string.itemTag);

You should also try cleaning your project by going to Project > Clean...

Post a Comment for "How To Solve "itemtag Cannot Be Resolved Or Is Not A Field"?"