Discussion Forums  >  Uncategorized

Replies: 9    Views: 631

dkeds66
Aspiring developer
Profile
Posts: 91
Reg: Jan 18, 2012
Swindon
910
02/02/12 08:30 AM (14 years ago)

Android and Databases - Data Entry in HTML

I am starting a new thread covering the specific topic of Databases in Android as there is some useful stuff emerging but its buried in a different thread and therefore hard to find: Here is the main history to date:- _________________________________________________________________________________________________________ Posted: by dkeds6 Mark - do you have any decent Buzz docs that cover HTML Data Entry Forms in BT >> PHP Scripts >> MySQL Lite DBs in Android?? I have built the forms, found a non BT doc covering -- Creating and Using Databases in Android -- (http://www.devx.com/wireless/Article/40842/1954) which is quite complicated ......but what I am really missing is how it all fits together I have built a website few years ago using HTML & PHP & MySQL DB server side so if its the same principals, wont be hard to learn again.....Do I need to know JAVA to do this in Android? Alternatively, do you have a basic Android App containing HTML Data Entry Forms in BT >> PHP Scripts >> MySQL Lite DBs in Android that I could take a look at? _________________________________________________________________________________________________________ Posted: by David @ Buzztouch @ dkeds66: Forms / Data Entry. For sure this is a idea that can go tons of different ways. Every single step of the design is related to others and the best approach is sometimes hard to figure out. Example, you could gather data with an HTML form then post to a backend database (like web programming). Or, you could create native input screens that communicate with a database you're running in the actual android devices. And, of course you could do tons of different things that combine these two ideas. It's very very challenging for non-programmers and beginners to get their head around these ideas, I applaud you for exploring them at all! Generally it boils down to taking these design considerations into account first... a) Where does the data need to be stored (persistent storage). Online, in the device, both? Online, and NOT in the device is almost always easier for web developers becuase HTML forms and scripts to receive the data are so common. b) What types of data are you looking to collect? Simple values, complex values? Simple numbers and words (like names and addresses) are much simpler than long complex data like images, videos, long text entries etc. c) How secure should the data be? Data on an Android device is not nearly as secure as most folks think. HTML + Script isn't either out of the box. But, it's generally easier to use a web technology, like https: to 'secure' transmissions to a backend database than it is to encrypt data in Android. Lots of opinions on this topic alone. It's hard to say what the best approach for you is without understanding more about the project. However, my hunch is that regardless of what you're trying to do, you'll be well served by reviewing all the pros / cons of data entry and storage BEFORE jumping into any code, it'll save you major time ;-) _________________________________________________________________________________________________________ Posted by dkeds66 With regard to your very relevant design questions here are my responses:- a) My app is designed specifically for folks who will be on the road so due to signal strength / web access constraints, all components of the App MUST be stored in the device and this includes the data and all calculations performed locally on device. b) Basically, the App will require the user to enter & maintain reference data relating to the Apps main objects (short object text descriptors, numeric values & dates related to those main objects - but nothing complex like images, videos, long text entries) and this reference data MUST be stored in tables within the devices. As and when required by the user, the user can select one of the objects in the database, enter additional data (numeric values) via a different screen, then on hitting submit, perform complex sql calculations using the reference & additional data values with the results (including additional data) also being saved back to a table in the devices database (for subsequent data export by user if required or as prompted by the App to keep data volumes low). c) The data is not uber sensitive per say I am not capturing credit card type data so no need to encrypt. With the above in mind what would you recommend is the most efficient approach bearing in mind my skillset? _________________________________________________________________________________________________________
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
02/02/12 09:54 AM (14 years ago)
I have played with the database setup that is described in the link you provided. Yes to me it was a little confusing to follow what and how it was being done. The thing that I decided to do, after reading and looking at it closer was to ... Follow each step one at a time the one that creates and fills the database .. that portion only, ran it as android app in sim. Looked and saw the database. Then I copied that file to a random folder and renamed it from DatabaseActivity to DatabaseAdd fixed the error that will be created (dont remember exact line but at top, naming the old filename use the new name). Then moved it back to the src folder again beside the other one. I then went to the next step and litterally replaced everything in the DatabaseActivity.java file with what was being shown. i.e. the next step. Ran that one again and looked to see what it did nad how it did it. Copy - Rename - Fix - Move - etc. Then on to next step. la la la la la Ok got to the end and have every single step in the process created and in a seperate file, to be called individually from a form or such. At least that is sort of how i understand how it **COULD** be done. If anyone has any better suggestion let me know as this will be some coding and there may be a shorter method. I also do not know if the calls to each of these other files will work or not, have not figured that part out yet. Thanks for posting this thread, I see many possibilities with this database setup. ADDED : I also am not sure how it is to be called via form or such, that will be the next step I look into. The reason for my wanting to use it would be to pre-fill a couple forms and to also use to create dynamic URLs (if that part is possible, still looking into that part on how to do it the easiest, but a database or sting set of some sort will be needed.
 
dkeds66
Aspiring developer
Profile
Posts: 91
Reg: Jan 18, 2012
Swindon
910
like
02/02/12 10:09 AM (14 years ago)
Cool - thanks FREESCOsoft for adding your findings - hopefully David may come back with more thoughts
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
02/02/12 10:20 AM (14 years ago)
I actually have not really done much, besides cobble my way through the tutorial. I do not know how Android needs to have the files names or linked or anything. All I do know is that it can be done ;-) but now to get it to do it as needed and correctly.
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
02/02/12 11:08 AM (14 years ago)
Found this http://codesnippets.joyent.com/posts/show/14578 About the same as the starting point you have a link to, but expanded, very expanded. Going to have a go at it this afternoon hopefully.
 
dkeds66
Aspiring developer
Profile
Posts: 91
Reg: Jan 18, 2012
Swindon
910
like
02/02/12 11:27 AM (14 years ago)
Excellent - thanks FREESCOsoft, will do the same tonight
 
ThomasB
Lost but trying
Profile
Posts: 162
Reg: Jun 23, 2011
Palo Alto
3,270
like
02/02/12 11:41 AM (14 years ago)
+Following
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/02/12 02:48 PM (14 years ago)
Hi gang, more thoughts.... There's not doubt that managing data on a device can be very very complex. The complexities are related to many factors. Things like the complexity of the database schema (a fancy word meaning how the database tables are related to each other), the complexity of the queries (a fancy word for adding, removing, and updating data records), and the complexity of the user interface and how it allows the user to find, add, remove, and update the underlying data model. The complexity of the backup and sync mechanisms necessary to make it do what it's designed to do (does it connect to the cloud, does it send data to other instances of the software running on different devices). These complexities in Android are no different than the very same complexities that surface in a web based application, a desktop application, or any other mobile application. A deep understanding of these ideas, and how they all interrelate is very challenging for most new programmers. With that being said, and after reading about the requirements explained by @dkeds66, it's apparent that a local mySQL (lite) database, on the actual device, is an appropriate design for the situation. None of the native buzztouch screens or code account for storing and saving data locally in a mySQL database. Lots of data is stored locally in flat text files (like configuration data and html data and pdf data, images, etc) but not in a relational database. This means that if a buzztouch app is going to use a local relational database, it will surely need to include some screens that understand the data model, how to interact with it, and how to modify the user interface accordingly. I don't know the best thing to recommend. I would love to think a remark like 'just add a database' would be sufficient but it's simply not. There are far to many factors involved. I can say that I have done lots of work with mysql lite in mobile devices and that none of it is as trivial as some of the tutorials claim. This lengthy article is the best I can find (I've referred to it lots of times) about the subject and does give a ton of info, code, and examples: http://www.vogella.de/articles/AndroidSQLite/article.html We do dream of one day creating some cool interfaces that act 'automagically' on local relational data but can't imagine it being anytime soon. Until then, about all I can offer is to bone up on the concepts, try to get an Android Activity running that connects to the local data store then expand from there.
 
dkeds66
Aspiring developer
Profile
Posts: 91
Reg: Jan 18, 2012
Swindon
910
like
02/02/12 05:10 PM (14 years ago)
thanks David... I will get there by hook or by crook then I'll happily share some working examples on the forum for all to use if they so desire
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
02/03/12 12:13 PM (14 years ago)
Following with baited breath. Fred
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.