I'm running through the notepad exercises on the android dev website, currently working on exercise (found here http://developer.android.com/resources/tutorials/notepad/notepad-ex2.html). I came to the end of the tutorial and found that I had several errors in the main two java files regaurding R file relations, such as 'setContentView(R.layout.notes_list);' and 'menu.add(0, INSERT_ID,0, R.string.menu_insert);' I've tried cleaning and re-genning R.java to no avail. These also occur in the solution for the exercise so I think they are deliberate mistakes, or something with my eclipse, but I can't seem to fix them, any help would be great thanks! Ieuan.
views:
574answers:
1
+3
A:
Do you have the layout notes_list.xml in your layout folder? Do you have a string by the name of menu_insert in your strings.xml? This might be the issue, because I think they don't give EVERYTHING in the tutorial... They do have them in the solution :
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<ListView android:id="@+id/android:list" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/android:empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_notes"/>
</LinearLayout>
in strings.xml in values folder :
<string name="menu_insert">Add Note</string>
Sephy
2010-07-23 17:01:00
The short answer is yes to all the above
2010-07-23 17:04:47
Then, try to check the imports at the top of your class, sometimes this dumb Eclipse imports the R class from the android package and stops using yours.
Sephy
2010-07-23 17:24:43
Haha great thats sorted it, guess I should have spotted that! I thought it was importing mine but thanks, that has fixed it.Im not a huge fan of Eclipse. Do you know how well the netbeans plugin for android performs?
2010-07-23 17:43:18
No idea, I've only been using Eclipse. Always worked properly for me. And if not, there is plentiful of doc and forum to find answers
Sephy
2010-07-23 18:34:49