English 中文(简体)
更新关于Android的 Sqlite 最佳方式
原标题:Best way to update sqlite on Android

我想要一些建议。 我将使用一个 Sqlite 数据库, 它将从我的服务器上提取信息, 然后保存在 DB 中, 然后显示它。 有人可以建议我用什么最佳方法 来填充 DB, 如果我...

  1. 使用 http 请求并返回 字符串除色, 并使用环以写入数据库 。

  2. 使用 JSON 检索信息,然后存储在数据库中。

这些信息将只是文本,有些字段将包含与我想下载的图像的链接(稍后再下载)。我只是想得到一些关于最佳做法的建议。我对SO和其他网站进行了一些搜索,但找不到很多建议。另外,作为侧边注意,你知道的对Noobs有好处的例子:)

最佳回答

根据你在这里的写作 我会选JSON

核心要点:

  • JSON is a standard format.
  • Android ships with a JSON lib (org.json) making it easy to handle it (encode / decode data).
  • JSON is known by a large community so you can ask questions and get them answered rather easily. With a custom format you cannot tag the question as json here at SO... ;-)

使用标准格式和图书馆可以帮助您避免自己设计和实施这种软件,从而使您的软件更加坚固。

稍后您可能需要在您的工程中添加更复杂的数据。 到那个时候, 使用 JSON 的阵列和对象将相当简单。 您的私人计划需要添加此功能并扩展解析代码。 这很容易引入细微的错误。 或者在那个时候, 您可能会决定, 您的自定义格式太难, 并且决定转到 JSON、 XML 等标准格式。 此时, 您要转换到一个标准格式要比您开始使用标准格式要花费更多得多。 考虑花费时间来写入和测试当前代码, 然后额外的时间来修改当前系统的标准格式 。

问题回答

暂无回答




相关问题
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 ...

热门标签