Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SQLIte Database Query

  • 22-03-2014 2:27pm
    #1
    Registered Users, Registered Users 2 Posts: 72 ✭✭


    Hi Folks,

    I am in the middle of completing my app and have the following query / problem if someone can assist me? -

    I have written the code to create mt database tables for my app which when you see it in a SQLite Database Browser, you can see all the tables (which i have attached copies of same).

    Now that the tables are created - my query is, how do i embed (if that is the right word) this into my app - or should i say, when the user of the app selects different options, depending on where they make these options, and click 'Save' i want to update these tables in the correct way....

    But how do i do this, and bare in mind i am a newby to this android development - Thanks

    I have attached pics of Screen 2 (this shows a listview of where the sites had previously been updated from Screen 3 or post the user 'Adds' a new site - this would need to populate the details each time the app is started as if the user clicks on any of these sites, they can edit the details.

    Screen 3 - this is where alot of the work/magic will happen - when the user enters all their details of the Site, including the other 2-3 screen for the other options on this page(Luminaires and operating schedule which gives another option in that screen).....
    ....Anyways after all the details are completed and the user clicks 'Save Site' - how do i get this then to update all fields / tables in the database???

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 2,040 ✭✭✭Colonel Panic


    You could either include the "empty" database as a resource , not sure how that's done in Android-land, or dump the schema for your database nd include THAT as a resource then on first run of the app, create the DB. I usually take the 2nd option.


  • Registered Users, Registered Users 2 Posts: 72 ✭✭shanard


    You could either include the "empty" database as a resource , not sure how that's done in Android-land, or dump the schema for your database nd include THAT as a resource then on first run of the app, create the DB. I usually take the 2nd option.

    Hi.... i not really sure what you mean..... the database tables i created in a java file in my android app.... are you saying to move this file/package from source and put it in another folder.... like assets for example or a folder in resources???

    Thanks


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I'm sorry, but you're going to have to try to ask your questions more clearly, because what you've posted so far is extremely convoluted.

    Are you asking how you package your database as part of your app, in the first place, or how do insert data into it during runtime? Or something else again?


  • Registered Users, Registered Users 2 Posts: 72 ✭✭shanard


    I'm sorry, but you're going to have to try to ask your questions more clearly, because what you've posted so far is extremely convoluted.

    Are you asking how you package your database as part of your app, in the first place, or how do insert data into it during runtime? Or something else again?


    Hi ya.... sorry for the ambiguity... but i am a newby to this..... i have my android app in one package and within the src (source) folder i created a new package where i designed the tables for the database - is this correct???

    I need to find out how to insert data into it during runtime...

    thanks corinthian..

    s.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    shanard wrote: »
    Hi ya.... sorry for the ambiguity... but i am a newby to this.....
    You're not a newbie to programming though, so try to explain what you mean, otherwise no one can help you.
    i have my android app in one package and within the src (source) folder i created a new package where i designed the tables for the database - is this correct???
    You can do it this way, but - especially for a relatively simple app - I'm not sure why you would want to. I can see where you might if you had a lot of database logic to deal with, but I'd just probably put all my database logic in a single class in the main package and use separate packages only for libraries that I could reuse in other apps, TBH.
    I need to find out how to insert data into it during runtime...
    Seriously - at least based upon my understanding of your problem - is Google or Stackoverflow.com blocked where you live?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,893 ✭✭✭The_B_Man


    Are you creating the app on your laptop and coping the db file into your source, and trying to perform actions on it there?
    Android can create a database for you without the need to package one. I thought that was standard practice.
    Then you can just do standard SQL insert statements to add the data to the tables.


Advertisement