Populating textview dynamically and related to another autocomplete textview

Ok here is the thing. My application has one autocomplete textview and under it a textview. In the autocomplete textview I've managed successfully to get employee names. I keep the list of employee names in a xml. The tricky part is that I need the second textview to be populated dynamically by the department of each employee. What is the best way to implement something like that. Are xmls able of such thing (by keeping the department in an attribute)? Should I use database? Any ideas?

Answers


That's a good question.. I think the first thing you need to decide is whether or not you move your xml to a database.

you can have a whole lot of reasons why you would want to do that. basically if you got anything to do with this list other then to plainly read it then moving it to a sqlite table will make your code more "standard".

you can move the your xml to a database on the very first run of the application (then every new instance of the app checks if this table exist and if it does it ignores the xml and goes to the db).

now about the storing the department information problem- if you have a limited number of departments there's a pretty easy way to do that- you can store each department's employees in a different string array (all of them can be stored in the same xml file) and then simply go throw each array and (for loop within a for loop) and save each employee with its department key.

you can feel free to chat or mail me. I had to do something similar in the past so i got some related code. Hope it helps.


Need Your Help

regarding an Immutable class defensive copying

java

I have a query regarding creating a Immutable class following are the points which I take in consideration..

Do you really need to convert Truths to values in Prolog?

prolog

I wrote a bubble sort in Prolog (code below). It works but it smells. I'm quite new to prolog. Here's the problematic part:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.