Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Need Help in SQLite database for Android

Need Help in SQLite database for Android

Scheduled Pinned Locked Moved Mobile
helpandroiddatabasesqlite
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mAzeem22
    wrote on last edited by
    #1

    I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.

    S D 2 Replies Last reply
    0
    • M mAzeem22

      I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.

      S Offline
      S Offline
      Sudhakar Shinde
      wrote on last edited by
      #2

      If you are using SQLiteOpenHelper object then database will be permanent.Two helper methods onCreate (To create DB when it does not exists) and onUpdate (used when db exists but has different version) are available. Refer http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html[^] to know more about SQLiteOpenHelper.

      1 Reply Last reply
      0
      • M mAzeem22

        I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.

        D Offline
        D Offline
        Dadecki
        wrote on last edited by
        #3

        Hello, I had the same problem. Please see my code and description below: Data base initialization:

        private SQLiteDatabase _mySqlLiteDataBase = MyActivity.this.openOrCreateDatabase("MyDataBaseName", Context.MODE_PRIVATE, null);

        Please note that method name is: openOrCreateDatabase. This mean that it will only create your database if it does not exists. Hope this will help.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups