I want to know what kind of way would be the easiest to maintain, and write the least amount of code to populate views, and load/store data.
I mostly write business applications, order entry, inventory, etc... so I have a lot of experience with asp.net web services and winforms, async web service calls, datasets, tables, sql and databases.
Typically I do the following:
Make a Dataset inside a class
Create a class for the result in with the same properties that i will add to say a listview.
A web service method, that gets the data using the dataset, and returns ListViewItems (my web service class, with values filled in)
In B4A I make a simple http request
parse the xml result, as I parse I Add items to the listview.
This isn't really a generic way of handling things though. What I mean by that, is if there's some sort of way to generically databind things to controls.
Something like:
ListView1.Label_DataProperty = "Name"
ListView1.SecondLabel_DataProperty = "Description"
ListView1.Value_DataProperty = "PersonId"
ListView1.DataSource = SomeInputStream 'Xml probably
Then being able to access the DataSource Property, Maybe save the datasource -> sdcard as an xml file, so if your activity restarts it will load that instead of a new http call.
I'm not sure if the same databinding concepts really apply here, and I know I can do lots of this stuff with global variables, I'm looking more for best practices and techniques that may exist that i'm not aware of. Just like in vb.net you can do things the long way, or see if there's already classes or something in place that can aid you more easily accomplish the same task and keep your code tidy. Usually the first thing I'll do is try to make a small framework to do all the plumbing work in a generic way so that I never have to deal with it anymore.
I see the DBUtils looks interesting. I think something like that but for XML would be helpful. Just wondering what avenue everyone else finds clean and simple.
I mostly write business applications, order entry, inventory, etc... so I have a lot of experience with asp.net web services and winforms, async web service calls, datasets, tables, sql and databases.
Typically I do the following:
Make a Dataset inside a class
Create a class for the result in with the same properties that i will add to say a listview.
A web service method, that gets the data using the dataset, and returns ListViewItems (my web service class, with values filled in)
In B4A I make a simple http request
parse the xml result, as I parse I Add items to the listview.
This isn't really a generic way of handling things though. What I mean by that, is if there's some sort of way to generically databind things to controls.
Something like:
ListView1.Label_DataProperty = "Name"
ListView1.SecondLabel_DataProperty = "Description"
ListView1.Value_DataProperty = "PersonId"
ListView1.DataSource = SomeInputStream 'Xml probably
Then being able to access the DataSource Property, Maybe save the datasource -> sdcard as an xml file, so if your activity restarts it will load that instead of a new http call.
I'm not sure if the same databinding concepts really apply here, and I know I can do lots of this stuff with global variables, I'm looking more for best practices and techniques that may exist that i'm not aware of. Just like in vb.net you can do things the long way, or see if there's already classes or something in place that can aid you more easily accomplish the same task and keep your code tidy. Usually the first thing I'll do is try to make a small framework to do all the plumbing work in a generic way so that I never have to deal with it anymore.
I see the DBUtils looks interesting. I think something like that but for XML would be helpful. Just wondering what avenue everyone else finds clean and simple.
Last edited: