保存用户配置文件的最佳方式详细介绍Android应用 [英] Best way to save user profile details android app

查看:205
本文介绍了保存用户配置文件的最佳方式详细介绍Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建其中有几个用户的应用程序。我创建了一个对象(用户),持有更多详细资料(姓名,年龄,自定义对象等)。因为我有一个自定义对象,我知道这很困难,使用共享preferences。什么是存储用户数据的最佳方式?我看着SQLite的,但我不能找到一个方法来保存自定义对象转换为SQLite的?

I'm creating an app which has several users. I've created an object (user), which holds more details (name, age, custom objects etc). Because I have a custom object, I know it'll be difficult to use shared preferences. What would be the best way to store the users data? I've looked into SQLite, but I can't find a way to save custom objects into SQLite?

任何意见将是AP preciated。

Any advice would be appreciated.

推荐答案

您可以存储使用任何ORM库对象,一个我建议是的 ORMLite

You can store objects in using any of the ORM libraries, one I would suggest is ORMLite

ORMLite 有一个Android的后台,这使得调用原生的Andr​​oid OS数据库API来支持其ORM功能。许多Android开发的成功使用框架。在这里看到更多的信息:

ORMLite has a Android backend which makes calls to the native Android OS database APIs to support its ORM functionality. A number of Android developers that are using the framework successfully. See here for more information:

http://ormlite.com/sqlite_java_android_orm.shtml

在多对多的关系方面,ORMLite不支持级联或任何更高级的ORM功能,但有易多到许多实现的示例:

In terms of many-to-many relationships, ORMLite does not support cascading or any of the more advanced ORM features but there are examples of easy many-to-many implementations:

http://ormlite.com/docs/examples

而不是将它们存储在SQLite的你可以将它们存储在 db4o的,这是专门为存储设计对象。使用sotring对象的简单教程 db4o的。

Use db4o with ORM

Instead of storing them in SQLite you may store them in db4o, which is specifically designed for storing objects. A simple tutorial for sotring objects using db4o.

这篇关于保存用户配置文件的最佳方式详细介绍Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆