How to compile my Android app in Eclipse? -
i'm going through android tutorials, , i'm having problem 1 of resource ids.
in res\menu\main.xml
file, have action_entry
defined in menu tag follows:
<item android:id="@+id/action_search" android:icon="@drawable:ic_action_search" android:title="@string:action_search" app:showasaction="ifroom" />
in res\values\string.xml
file, have next string defined:
<string name="action_search">search</string>
finally, in onoptionsitemselected()
function, have next code references id:
switch (item.getitemid()) { case r.id.action_search: //opensearch(); homecoming true; ... }
according before lesson in tutorial, @+id means id generated when app compiled, naturally i'm expecting case r.id.action_search:
line in error until then; however, when go run app (which thought trigger compile whenever necessary), error message stating project contains errors have fixed before running app.
how forcefulness compile of app id added generated file contains ids in project? without actual compile command, i'm kind of stuck in catch-22 situation: can't run app until prepare error, prepare error, have compile app generates id, , way know run app. alternatively, how create ide generate new id app compiles when run it?
it should automatically update r.java
file, if using @+id/
. however, not automatically update if there issue in 1 of xml files.
<item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" app:showasaction="ifroom" />
try this.
android eclipse
No comments:
Post a Comment