activeandroid

Two column unique constraint ActiveAndroid

随声附和 提交于 2019-12-12 12:32:22
问题 How can I add two column unique constraint in ActiveAndroid? I tried to add 2.sql and increase DB version, but it doesnt seem to be updated correctly (probably because I reinstall the app?). Anyway, is there are way to add some annotation on which I can apply two column unique constraint in ActiveAndroid ? <meta-data android:name="AA_DB_NAME" android:value="Diggecard.db" /> <meta-data android:name="AA_DB_VERSION" android:value="2" /> 回答1: Use the uniqueGroups property in the @Column

Android RecyclerView + ActiveAndroid

五迷三道 提交于 2019-12-12 12:04:12
问题 What is the preffered way of populating a RecyclerView and keeping track of data changes using ActiveAndroid ORM? I've asked a question on this topic recently. But it got too verbose, and people are so lazy, that someone would scarcely read it till the end. The very essence of it: Does somebody have a working example of RecyclerView populated from a database through ActiveAndroid? 回答1: I had used this library once, but with a ListView . I think this code should work with the RecyclerView : /*

Android Studio cannot resolve symbol from imported module

拜拜、爱过 提交于 2019-12-10 11:26:10
问题 I have an android app that worked great. I have imported the ActiveAndroid project as a module because I did a change on the Model's file (I added a setId method, and that's why I can't use the gradle's version). I was using Android Studio 1.5 and gradle 1.5.0. I have updated the android studio version to 2.2 (which make me update the gradle version to 2.2.0-alpha1. Then now, the import of active android fails. For instance: import com.activeandroid.Model; Detects an error: cannot resolve

How to drop and recreate all tables on DB version update in ActiveAndroid?

*爱你&永不变心* 提交于 2019-12-10 11:25:49
问题 I'm using ActiveAndroid in my application as the Database system. At current stage I don't want to write the migration files for migrating current tables to altered ones for when I update DB version. Instead what I want to do is to drop all tables and recreate a new set of tables. Unfortunately from digging in the ActiveAndroid the Database version test happens at initialization stage in which I pass a ActiveAndroid Configuration object to configure the Database . At this point their

How to update table with activeandroid after adding a new column

烈酒焚心 提交于 2019-12-09 11:22:11
问题 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

Active Android many-to-many relationship

…衆ロ難τιáo~ 提交于 2019-12-06 22:41:29
问题 Although this question is about ActiveAndroid, anyone who is familiar with ORMs could probably answer this question. ActiveAndroid doesn't seem to give you a way to do many-to-many relationships out of the box. What I found while searching for a solution was this GitHub issue: https://github.com/pardom/ActiveAndroid/issues/46 I understand that it's explicitly creating the relationship table, but I don't understand how the following part is supposed to do anything useful: public List<Foo> foos

Retrofit data persistence

不羁的心 提交于 2019-12-06 15:20:15
问题 How do I persist the data that has been parsed from the server using Retrofit library. So that users can view it when there is no internet connection. final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.post_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(this)); ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); Call<ArrayList<Post>> call = apiService.getAllPosts(); call.enqueue(new Callback<ArrayList<Post>>() { @Override public

How to drop and recreate all tables on DB version update in ActiveAndroid?

独自空忆成欢 提交于 2019-12-06 14:31:21
I'm using ActiveAndroid in my application as the Database system. At current stage I don't want to write the migration files for migrating current tables to altered ones for when I update DB version. Instead what I want to do is to drop all tables and recreate a new set of tables. Unfortunately from digging in the ActiveAndroid the Database version test happens at initialization stage in which I pass a ActiveAndroid Configuration object to configure the Database . At this point their implementation only checks for migration files in the assets folder. I don't mind to create migrations file to

Storing HashMap<String, Object> with using ActiveAndroid library

三世轮回 提交于 2019-12-06 13:55:48
问题 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

Android Studio cannot resolve symbol from imported module

邮差的信 提交于 2019-12-06 06:40:23
I have an android app that worked great. I have imported the ActiveAndroid project as a module because I did a change on the Model's file (I added a setId method, and that's why I can't use the gradle's version). I was using Android Studio 1.5 and gradle 1.5.0. I have updated the android studio version to 2.2 (which make me update the gradle version to 2.2.0-alpha1. Then now, the import of active android fails. For instance: import com.activeandroid.Model; Detects an error: cannot resolve symbol 'Model'. What is going on? How can I solve that issue? Thanks a lot! It's a bug in Android Studio 2