humazed
humazed

Reputation: 76912

What is the most suitable way to save that data in android

I'm making an app that will ask the user for his faculty, department and grade and then show List of subjects.

the question is what is the best way to save subjects that it can be easy to retrieve them and display them to the user.

I tried XML but it doesn't work and now I'm tried JSON but not sure if it the best way to store that kind of data?

ANSWER:

as all people say the best way is to save the data in SQLite dataBase.

here is a snap of my JSON

{
  "faculty_engineering": {
    "name": "Engineering",
    "department_prep": {
      "name": "prep",
      "grade_1": {
        "term_1": {
          "subjects": [
            "Math",
            "physics",
            "English",
            "Realisation",
            "subject"
          ]
        },
        "term_2": {
          "subjects": [
            "chemistry",
            "Math",
            "fekh",
            "Geometry",
            "Entag",
            "Mechanics"
          ]
        }
      }
    },
    "department_systems_and_computer_engineering": {
      "name": "Systems and computer engineering",
      "grade_1": {
        "term_1": {
          "subjects": [
            "Programming",
            "Electronics",
            "Math",
            "Circuits",
            "Measure",
            "English"
          ]
        },
        "term_2": {
          "subjects": [
            "Algorithms",
            "Electronics",
            "Math",
            "Fields",
            "Religious subject"
          ]
        }
      },
      "grade_2": {
        "term_1": {
          "subjects": [
            "Math",
            "Integrated circuits",
            "Systems and signals",
            "machines  VHDL",
            "Numerical Analysis",
            "Object-oriented programming",
            "Tests",
            "Realisation subject"
          ]
        },
        "term_2": {
          "subjects": [
            "Math",
            "Logical circuits",
            "Automatic Control",
            "Electric machines",
            "Religious subjects",
            "Realisation subject"
          ]
        }
      },
      "grade_3": {
        "term_1": {
          "subjects": [
            "Math",
            "Communications systems",
            "Electronics",
            "Religious subjects",
            "Operating system",
            "Digital Control",
            "Tests ",
            "Transition systems and mechanisms ",
            "Power electric systems ",
            "Realisation subject"
          ]
        },
        "term_2": {
          "subjects": [
            "Databases",
            "Microprocessors",
            "Administration and engineering projects",
            "Sensors of adapters",
            "Religious subjects",
            "Realisation subject"
          ]
        }
      },
      "grade_4": {
        "term_1": {
          "subjects": [
            "Special computer subject",
            "Tests",
            "Engineering programming",
            "Intelligent Systems",
            "Computer architecture",
            "Interpreters",
            "Advanced software",
            "Realisation subject"
          ]
        },
        "term_2": {
          "subjects": [
            "Algorithms",
            "Advanced software",
            "Computer architecture",
            "Interpreters",
            "Realisation subject"
          ]
        }
      }
    },
    "department_": {
      "name": "",
      "grade_1": {
        "term_1": {
          "subjects": [
          ]
        },
        "term_2": {
          "subjects": [
          ]
        }
      },
      "grade_2": {
        "term_1": {
          "subjects": [
          ]
        },
        "term_2": {
          "subjects": [
          ]
        }
      },
      "grade_3": {
        "term_1": {
          "subjects": [
          ]
        },
        "term_2": {
          "subjects": [
          ]
        }
      },
      "grade_4": {
        "term_1": {
          "subjects": [
          ]
        },
        "term_2": {
          "subjects": [
          ]
        }
      }
    }
  }
}

Upvotes: 0

Views: 79

Answers (4)

soham97
soham97

Reputation: 11

If you want offline storage then go for SQLite.

If you want cloud storage then go for Google Firebase as it provides good abstraction for implementation, fair amount of storage and simultaneous connections.

Upvotes: 0

jekeyeke
jekeyeke

Reputation: 301

You can use https://realm.io/ that it's compatible between Android and iOS. It's more simply and quickly.

Hope it helps.

Upvotes: 1

user5267814
user5267814

Reputation:

Maybe you should use a SQLite database : https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

JSON and XML are more likely to be used to transfer data, using network for instance.

Upvotes: 1

Taha Rushain
Taha Rushain

Reputation: 635

If the data to be queried is not on a remote server then you can use Android sqlite database to save and fetch data.

Upvotes: 2

Related Questions