activeandroid

How can I use Active Android with an in memory database for unit tests using Robolectric?

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:44:47
As the title says. I am aware that there is a limited in memory database provided in robolectric. Is there any way to use this with Active Android? Under the default configuration, it appears that the database is cleared after all the tests are run, but not for each test. Daniel I use greenDao - but the principle is the same. My Application class initialises my DB (the DB has a name). For my tests I subclass Application (which allows Robolectric to call this version instead) and override the method that gets the DB name - and return null. This then means I create an in memory DB. As the

Storing HashMap<String, Object> with using ActiveAndroid library

断了今生、忘了曾经 提交于 2019-12-04 18:18:31
I have a class: @Table(name = "Control") public class Control extends Model{ @Column private String name; [...] @Column private Map<String, Object> properties; } I have other fields in this class, but i wrote here only those which is enough to show what is my problem. I got an exception about insertion: 09-14 22:11:34.542: E/SQLiteLog(11482): (1) table Control has no column named properties Object can be either String[] or String. If I dont place @Column on HashMap data, than everything works "fine" only the problem they are not stored. So my question is how should I solve storing this hashmap

Use ActiveAndroid on existing database-content

妖精的绣舞 提交于 2019-12-04 00:36:19
I developed an Android-App where I saved data in a SQLite database using the SQLiteOpenHelper. I am wondering if I could update my app by using ActiveAndroid , but in a way that the user data previously stored in the database will be preserved. Is that possible? You would have to perform a data migration during runtime after the user upgrades to the newest version of the app. The process could be broken down into the following steps, I have also assigned database version values to each step. The user has all of their data stored in a SQLite database and has not upgraded their app yet. [DB =

How to update table with activeandroid after adding a new column

天大地大妈咪最大 提交于 2019-12-03 14:55:38
thank you for reading and helping :) I am using ActiveAndroid 3.0 - Android 2.2 - In my app I have a model called "user". initially I only created the model with (id, name, passcode) columns/attributes, I ran the app on the emulator, and it worked. @Table(name = "user") public class User extends Model { @Column (name = "name") public String name; @Column (name = "pass_code") public String passCode; } Then I added a new column/attribute - profileImage. I ran the app on the emulator and i got SQLite column profileImage does not exist error. @Table(name = "user") public class User extends Model {

Auto increment in active android

大憨熊 提交于 2019-12-02 14:54:51
问题 I tried to use active android, i have a doubt about how could i achieve a auto-increment field in a table? In their documentation they have provided a code like this Item item = new Item(); item.remoteId = 1; item.category = restaurants; item.name = "Outback Steakhouse"; item.save(); Can we make the remoteId field auto-increment? 回答1: In sqlite you should use Autoincrement tag in create table: http://www.sqlite.org/autoinc.html In other cases use methods like getPrev(), getNext(), etc. 来源:

Auto increment in active android

人走茶凉 提交于 2019-12-02 11:56:22
I tried to use active android, i have a doubt about how could i achieve a auto-increment field in a table? In their documentation they have provided a code like this Item item = new Item(); item.remoteId = 1; item.category = restaurants; item.name = "Outback Steakhouse"; item.save(); Can we make the remoteId field auto-increment? In sqlite you should use Autoincrement tag in create table: http://www.sqlite.org/autoinc.html In other cases use methods like getPrev(), getNext(), etc. 来源: https://stackoverflow.com/questions/26096525/auto-increment-in-active-android

Robolectric with ActiveAndroid setup nullpointerexception on ActiveAndroid$ReflectionUtils

我的未来我决定 提交于 2019-12-02 06:00:28
问题 I am trying to implement robolectric testing in an existing app. I can run simple static tests but when I add testing with ActiveAndroid I get NullPointerExceptions, I think ActiveAndroid can not be found when the unit test is being run. Im not sure maybe there are some configurations for ActiveAndroid for Robelectric unit testing. Kindly help me on this one. This is the project structure: MainApp -src/main -src/test LibraryApp -src/main/models <--- here are my models and classes for active

ActiveAndroid Many-to-many relationship

天涯浪子 提交于 2019-11-30 04:23:14
问题 I’m currently using ActiveAndroid, and have been trying to get a many-to-many relationship to work for the past few hours, however I just can’t get it to work. I hope you can help me out: I have the models “Student” and “Course”, a student can have many courses, and a course has many students. Basically this is what I have in the model “StudentCourse”: @Column(name = COURSE) public Course course; @Column(name = STUDENT) public Student student; public StudentCourse(Student student, Course

Green DAO vs ORM lite vs Active Android [closed]

萝らか妹 提交于 2019-11-29 20:23:33
Which is the best ORM tool available for Android? I am seeing ORMlite and ActiveAndroid are the most discussed across and a friend of mine suggested me to use GreenDAO. So looking for some knowledge resource which can help me in Decision Making? Features I am looking to judge are freely available (open source), good documentation, active forums, stable version available, etc, which ever required for developer. I would suggest ORMlite its open source freeware & has good documentation also it support java as well as android. It has good developer support & many application running on ORMlite

android orm sqlite

强颜欢笑 提交于 2019-11-29 06:12:59
http://satyan.github.io/sugar/ 不错,就是文档太恶心鸟 http://greendao-orm.com/features/ http://greendao-orm.com/documentation/how-to-get-started/ 还是greenDao吧。 相比greenDao用的应该比较多,稳定,性能好,但是太麻烦,学习成本高,还要code generate,没时间研究 https://github.com/pardom/ActiveAndroid 还是这个把,文档齐全,可以Bulk Insert,不错,看看 update http://stackoverflow.com/questions/22997326/activeandroid-update-query http://www.cnblogs.com/GarfieldTom/p/3877077.html http://blog.csdn.net/djun100/article/details/23352129 https://dl.google.com/dl/android/studio/install/1.0.1/android-studio-bundle-135.1641136.exe Whenever your schema changes you need to