2015-08-28 64 views
0

我正在做一個應用程序,將要求用戶的教師,部門和成績,然後顯示主題列表。什麼是最合適的方式來保存在android的數據

問題是保存主題的最佳方式是什麼,它可以很容易地檢索並顯示給用戶。

我試過XML,但它不起作用,現在我試過JSON,但不知道它是否是存儲這種數據的最佳方式?

答:

,因爲所有的人說,最好的辦法就是保存SQLite數據庫中的數據。

這裏是我的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": [ 
      ] 
     } 
     } 
    } 
    } 
} 
+1

我會將它們保存在數據庫中。 – BackSlash

+0

只是使用SQLite – CantThinkOfAnything

+1

如果你需要一個教程:http://www.vogella.com/tutorials/AndroidSQLite/article.html – CantThinkOfAnything

回答

2

如果要查詢的數據不是一個遠程服務器,那麼你可以使用Android的SQLite數據庫來保存和獲取數據上。

0

如果你想離線存儲然後去SQLite。

如果您想要雲存儲,然後轉到Google Firebase,因爲它提供了很好的實現抽象,相當數量的存儲和同時連接。

相關問題