Featured post
java - Android - how to inflate a view with multiple EditText fields and read their values? -
for android application, want have view allows user click plus button add edittext fields, , next edittext fields, want have minus buttons remove them view. in essence, similar adding multiple phone numbers/email addresses in edit contact interface on android.
i imagine need inflating main view separate 1 contains edittext , button want add each time. however, have no idea how manage identifying each edittext , button unique id, , thus, have no idea how manage grab values of each edittext saving database. can advise me on need do? thank you.
if have inflated sub-layout, should have view
object.
you can call findviewbyid(r.id.edit_text_1)
on view
— assuming supplied ids in sub-layout xml.
so long keep track of each of parent view
s, can use findviewbyid()
on them. or after inflation, if want can set new, globally-unique id on each edittext
using setid()
.
- Get link
- X
- Other Apps
Comments
Post a Comment