开发者

Using text field with AdapterView

开发者 https://www.devze.com 2023-01-01 19:46 出处:网络
Is it possible to use AdapterView with text fields in android? My query returns a set of values and for each I want to place that within a textfield, so that the user may edit the value.

Is it possible to use AdapterView with text fields in android?

My query returns a set of values and for each I want to place that within a textfield, so that the user may edit the value.

Also, I want to click a开发者_高级运维 button to create a new empty field, so that I may insert a new entry.

If you know of good example, then please let me know!

EDIT 1

I would prefer to use XML to define ui and I found this informations:

"In this case we create a new id called text1. The + after the @ in the id string indicates that the id should be automatically created as a resource if it does not already exist, so we are defining text1 on the fly and then using it." Source http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html

Will this + allow me to autocreate as many fields as needed? Is there a way I can generically specify the layout in XML and then create fields adhoc based on db response?

Many thanks,

Mith


Is it possible to use AdapterView with text fields in android?

Yes. It will be complex for you (and possibly also for the user), so I would not recommend it unless you have a few months' Android programming experience, but it should work.

Also, I want to click a button to create a new empty field, so that I may insert a new entry.

That will get a little complicated.

Will this + allow me to autocreate as many fields as needed?

No, that is not how you use ListAdapters for ListView rows.

Is there a way I can generically specify the layout in XML and then create fields adhoc based on db response?

Use a CursorAdapter.

Here is a free excerpt from one of my books that describes creating custom adapter classes. Here is a sample project that shows creating a custom CursorAdapter to display the results of a database query.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号