user3061876
user3061876

Reputation: 161

Cannot get reference to layouts and id in res. folder

This question has been up a couple of times but still I haven't found an answer that helped me.

1:st one: I cannot find any of my R.Layout.activity_article_detail and other layout xml files through reference. It stopped working after did a "clean project" in Eclipse and tried to build it up again. I've tried removing and adding and removing the .R import but right now it wont find any of them. My layout files doesn't include a Capital letter, are spelled correcly. code:

package martin.larsson.kopingsrssreader;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

import martin.larsson.kopingsrssreader.R;

public class ArticleDetailActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_article_detail);

Second problem is it cant find my res.menu either. I got 2 files in it. detailmenu.xml and refreshmenu.xml. In both i cant find any of the id tags

    <item android:id="@+id/actionbar_markunread"
    <item android:id="@+id/actionbar_saveoffline"
    <item android:id="@+id/actionbar_refresh"

Does anyone got a clue?

SOLUTION: Uncheck "build automatically" and do a "clean project", and a Eclipse restart.

Upvotes: 0

Views: 1013

Answers (2)

fida1989
fida1989

Reputation: 3249

  1. Clean your project or restart the eclipse.
  2. Look to the imports, the R imported maybe is not correct.
  3. If anything is wrong in your layouts, new updates aren't added to the R file. Look at the errors panel, and possibly to a clean rebuild to see what errors are popping up.

Upvotes: 2

dmSherazi
dmSherazi

Reputation: 3831

if u have an error in any of the resource files R will show up red unless all Errors are fixed and the project is built

Upvotes: 0

Related Questions