Saturday, 15 August 2015

java - Can Android ID resources refer forwards? -



java - Can Android ID resources refer forwards? -

can id resources refer element later in file?

here have 2 fields, 1 username, , password. create new id resource (with @+id/ syntax) password field, username field cannot find in android:nextfocusdown field. have omitted other fields layout xml, because aren't relevant.

how need declare ids in case?

<edittext android:id="@+id/login_username" android:nextfocusdown="@id/login_password" /> <edittext android:id="@+id/login_password" android:nextfocusup="@id/login_username" android:nextfocusdown="@id/login_submit" />

building gradle, i'm getting error looks this: error:(41, 32) no resource found matches given name (at 'nextfocusdown' value '@id/login_password').

i not error android:nextfocusup="@id/login_username" field, leads me believe must declare id before utilize it.

i compile errors in code, because no r.java file beingness generated, because resources builds aren't building either.

with fancy build tools in android, i'm surprised problem. known problem or desired behavior?

you can pre-generate ids creating file values/ids.xml this

<resources> <item name="login_password" type="id"/> </resources>

here case http://stackoverflow.com/a/12247971/4178124

java android build gradle android-xml

No comments:

Post a Comment