Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:21:50+00:00 2026-06-08T23:21:50+00:00

In my project I have got some classes and some layouts. I add a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:21:51+00:00Added an answer on June 8, 2026 at 11:21 pm

    If you have a class in a subpackage, e.g. com.tom.mypackage, you have to import your R from base package mentioned in manifest. Just put import statement into you classes which are in subpackages and which don’t see the R:

    package com.tom.menu; // class in subpackage
    
    import com.tom.R;  // This will get you your R from base package
    
    import android.app.Activity;
    
    public class NewGameActivity extends Activity {
    
    // use R here like you are used to
    
    // remainder omitted...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some difficulties in my project. I got the RGB values from a
I'm new in eclipse and I have got a project that can add and
I have got a Class Library project where I keep some interfaces and classes
I just got a project that have some core classes that uses static methods.
i have done some learning on struts based on one project that i got.Now
I have some problem while trying to use the schemagen tool from JAXB library
I've got a problem with implicit casting, templates and inheritance from template classes. The
I've got some autogenerated *.m and *.h files (from mogenerator) that I have put
I have created a new iPhone project in Xcode 4 and added some files
I am new in ASP.NET MVC. I have got a full project, trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.