Android Question Array/List Vs SQL --- Answered

Roger Daley

Well-Known Member
Licensed User
Hi All,

I have a Google Map APP to which I want to include a function of Storing/Recalling/Deleting locations by Name along with their Longitude and Latitude.

This can be achieved with an array/list combination, but I keep reading that a SQL database is a better solution. Not having any experience with SQL this would take me a serious investment of time.
The list would be sorted automatically alphabetically by Name.
Longitude and Latitude would not be displayed when the list is viewed and would not be used for any operations such as sort/filter.

For such a simple list of locations what would be the advantages [if any] of going SQL?


Regards Roger
 

DonManfred

Expert
Licensed User
I am asuming you are familar with Map and List.

Start with using KeyValueStore2 (from B4A 8 it is included as internal library).
No need for SQL Knowledge. Internally it is using SQL to store the values.

Create a list with all your infos and store the list in KVS. On appstart you can read this list back from the KVS and create the markers or whatever and use them in GoogleMaps.

Away from that i suggest to have a look at the beginnersguide from Klaus. There are excellent Examples about SQL in there.

SQL is most probably the best solution as you can filter, sort, query the content you want to get.
 

klaus

Expert
Licensed User
I would suggest you to look at SQL.
Why? You can sort filter what ever you want very easily. Even if for now you think you don't need it, I am sure that in a near furure you want these features.
It is not that complicated, a few years ago, I had never used a database.
Then I found the need for it looked deeper into it and found it relatively easy and asked myself: why hadn't I looked at this before?
You can have a look at the B4X SQL Database booklet, it includes simple SQL projects.
 

Roger Daley

Well-Known Member
Licensed User
Thanks DonManfred,

I have been looking at Klaus' examples and felt my small list didn't warrant such a solution.

What you've suggested is pretty much where I was headed. [The user gets to enter the data, push a button Name/Lat/Lng recorded, Recall and the marker returns to location.
I've used KVS in other APPS but as I haven't done much in B4A in over a year I'm lucky to be able to spell it.

Regards Roger
 
Last edited:

Roger Daley

Well-Known Member
Licensed User
I would suggest you to look at SQL.
Why? You can sort filter what ever you want very easily. Even if for now you think you don't need it, I am sure that in a near furure you want these features.
It is not that complicated, a few years ago, I had never used a database.
Then I found the need for it looked deeper into it and found it relatively easy and asked myself: why hadn't I looked at this before?
You can have a look at the B4X SQL Database booklet, it includes simple SQL projects.
Thanks Klaus,
Looks like we cross posted there.
You are undoubtedly correct in the long term, I will think about it over night. Bite the bullet or wimp out.

Regards Roger
 

Jmu5667

Well-Known Member
Licensed User
Learn SQL, it is not difficult, and it will benefit you in the long term. I have class's I can send you for creating and maintaining the database if you are interested.

Regards

John
 

Roger Daley

Well-Known Member
Licensed User
Learn SQL, it is not difficult, and it will benefit you in the long term. I have class's I can send you for creating and maintaining the database if you are interested.

Regards

John
Thanks John,
I know you are correct in the long term but I was looking at this specific instance. I'm a bit pushed for time and if there is no pressing reason for SQL this sought of time investment may be for the
future.
Over night thinking cap firmly on head.

Regards Roger
 
Top