English 中文(简体)
数据存储 - 歌曲文集应用的哪个方法?
原标题:Data Storage - which approach for a song-lyrics-app?

我想写一个基本上在列表视图中显示歌曲标题的机器人应用程序,并且通过在列表中选择一首歌曲,该歌曲的歌词在文本视图中显示。 在第二步中,可能会有每首歌曲歌词的翻译。

到目前为止,没有什么太复杂,但是,由于我对编程和机器人编程是完全新的,我想知道储存数据的最佳方法是什么(即歌词/歌词 ) 。 我想到了每首歌的单个( xml? ) 文件( xml? ) 文件的名称是文件名, 而文件包含歌词。 我认为这样很容易添加新的歌曲。 这些文件通常会存储在哪里? / res/ xml?

另一种方法是否更合适?数据库储存?内容提供者?

问题回答

我将使用数据库和内容提供者,因为使用装载器API将内容与ListPiews连接起来已变得非常微不足道。

根据有关"的文献资料, http:// developmenter.android.com/guide/topics/data/data/data-storage.html" rel=“nofollow”>Data de存 , 您有几种选择。

但似乎能满足你需要的存储策略 是“坚固”的SQLite数据库

你可以使用"http://developmenter.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html" relation=“nofollow”>SQLiteOpenHelper ContentProvider ,使其发挥作用。

这需要大量的工作和理解才能实施,但值得努力:

  • Esier than other solutions to manipulate data once it stored.
  • A lot of android component are designed to work with databases cursors.
  • Easy to add new data and structures as your application evolves.
  • You will learn a lot about how develop android apps "the right way".

如果我是你,我会“强势”避免“/强势”:

  • < a href=" "http:// developmenter.android.com/guide/topics/data/data-storage.html#pref" rel="no follow" >sharedPreferences , 因为这不适合数据列表, 因为没有任何“ id机制 ” 。 另一方面, 在小设置中使用它相当容易 。

  • Internal de存 ,因为数据存储后难以操作。另外,它也不是存储这类数据的建议方式。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签