In my project I have got some classes and some layouts. I add a new package to my project and I in new classes from this new package there is a problem: e.g. when I writing “setContentView(R.layout.author_xml);” I have got red underline and comunicate: “R cannot be resolved to a variable”. In adnroid manifest when I use activity from new package I add:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tom"
android:versionCode="1"
android:versionName="1.0" >
<activity
android:name=".menu.NewGameActivity"><!--I add .menu-->
</activity>
Generally in classes from new package I can’t see a layout. Maybe I should add something in layout, e.g:
android:package=”com.tom.menu” -> but it doesn’t work.
What can I do in this situation? Thank you in advance.
If you have a class in a subpackage, e.g.
com.tom.mypackage, you have to import yourRfrom base package mentioned in manifest. Just put import statement into you classes which are in subpackages and which don’t see theR: