Giter Site home page Giter Site logo

reactiveandroid's Introduction

Hi 👋, I'm Mahach.

An Android developer from Dagestan, Russia

  • 📆 Experienced in Android since 2014
  • 🖥️ Aspired by learning something new
  • ✔️ Apart from work developing Bubbble - an unofficial Dribbble app for Android

My projects

Here you can find some of my projects

📑 Articles

🎨 Apps

📐 Libraries

🔨 Tools

  • null

reactiveandroid's People

Contributors

dookah avatar imangazalievm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactiveandroid's Issues

How to serialize an array?

ReActiveAndroid Version: 1.4.3

Bug or Feature Request:
How to serialize int array?

Description:
I have a column that is of type int[]:

@Table(name = "Notes", database = AppDatabase.class)
public class Note extends Model {
    @PrimaryKey
    private Long id;
    @Column(name = "title")
    private String title;
    @Column(name = "text")
    private String text;
    @Column(name = "color")
    private int color;
    @Column(name = "numbers")
    private int[] numbers;
}

I want to serialize it as String (e.g. "[1,2,3]") so I made an IntArraySerializer:

public class IntArraySerializer extends TypeSerializer<int[], String> {
    @Nullable
    @Override
    public String serialize(@Nullable int[] data) {
        if (data == null) return null;

        return new Gson().toJson(data);
    }

    @Nullable
    @Override
    public int[] deserialize(@Nullable String data) {
        if (data == null) return null;

        return new Gson().fromJson(data, int[].class);
    }
}

But when I call ReActiveAndroid.init()

        DatabaseConfig appDatabaseConfig = new DatabaseConfig.Builder(AppDatabase.class)
                .addModelClasses(Note.class, Folder.class, NoteFolderRelation.class)
                .addTypeSerializers(IntArraySerializer.class)
                .disableMigrationsChecking()
                .build();

        ReActiveAndroid.init(new ReActiveConfig.Builder(this)
                .addDatabaseConfigs(appDatabaseConfig)
                .build());

app crashes with following error:

01-14 11:12:41.862 16691-16691/com.reactiveandroid.sample E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.reactiveandroid.sample, PID: 16691
    java.lang.RuntimeException: Unable to create application com.reactiveandroid.sample.App: java.lang.RuntimeException: java.lang.ClassCastException: libcore.reflect.GenericArrayTypeImpl cannot be cast to java.lang.Class
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6425)
        at android.app.ActivityThread.access$1800(ActivityThread.java:229)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:7325)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
     Caused by: java.lang.RuntimeException: java.lang.ClassCastException: libcore.reflect.GenericArrayTypeImpl cannot be cast to java.lang.Class
        at com.reactiveandroid.internal.database.DatabaseInfo.loadTypeSerializers(DatabaseInfo.java:148)
        at com.reactiveandroid.internal.database.DatabaseInfo.<init>(DatabaseInfo.java:45)
        at com.reactiveandroid.ReActiveAndroid.init(ReActiveAndroid.java:53)
        at com.reactiveandroid.sample.App.onCreate(App.java:80)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6422)
        at android.app.ActivityThread.access$1800(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7325) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
     Caused by: java.lang.ClassCastException: libcore.reflect.GenericArrayTypeImpl cannot be cast to java.lang.Class
        at com.reactiveandroid.internal.serializer.TypeSerializer.<init>(TypeSerializer.java:21)
        at com.reactiveandroid.sample.utils.IntArraySerializer.<init>(IntArraySerializer.java:0)
        at java.lang.Class.newInstance(Native Method)
        at com.reactiveandroid.internal.database.DatabaseInfo.loadTypeSerializers(DatabaseInfo.java:137)
        at com.reactiveandroid.internal.database.DatabaseInfo.<init>(DatabaseInfo.java:45) 
        at com.reactiveandroid.ReActiveAndroid.init(ReActiveAndroid.java:53) 
        at com.reactiveandroid.sample.App.onCreate(App.java:80) 
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6422) 
        at android.app.ActivityThread.access$1800(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7325) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

P.S. This worked in https://github.com/pardom-zz/ActiveAndroid

Pagination Method via API

ReActiveAndroid Version:
latest

Bug or Feature Request:
Access to method of pulling data from DB as Pagination

Description:
Another great feature I would like to see is access to API method of basic Pagination fetching;
User can, via code, pull List via pagination:

  • pass Table.class
  • pass limit params
  • pass order by params
  • pass column to order by params
  • pass first id & last id to BETWEEN or;
  • pass last id to perform where("id > ?", lastId)
public List<> fetchPagination(Long firstId, Long lastId, int limit, String orderBy, db.class myModelClass) {

            List<myModelClass> result = new ArrayList<myModelClass>();
            String defaultSortBy = "DESC";
            if(sortBy !=null){
                defaultSortBy = sortBy;
            }

            List<myModelClass> myModelClassList = Select.from(myModelClass.class).where("id > ?", lastId)
                        .orderBy("id " + defaultSortBy)
                        .limit(limit)
                        .fetch();

                result = myModelClassList ;

            return result;

}

I use the above internally to do this, however would be great if was accessible via API within the library.

Pass Comma Deliminated String & IN SQL Query

ReActiveAndroid Version:
latest
Bug or Feature Request:
Pass Array String for using WHERE.IN sql query

Description:
When using the below I get an exception error as where() seems to not accept all internal sql clauses types, although I have used BETWEEN before ..

Error

#################################################################
    Error Code : 1 (SQLITE_ERROR)
    Caused By : SQL(query) error or missing database.
    	(near "?": syntax error (code 1): , while compiling: SELECT * FROM Notes WHERE id IN ? ORDER BY id ASC LIMIT 20)
    #################################################################

String myCommaStingOfIds = "86973,86974,86975,86976,86977,86978,86979,86980";
where.("id IN ?", "(" + myCommaStingOfIds + ")");

Refer to http://www.tutorialspoint.com/sqlite/sqlite_where_clause.htm

How to set database file location

ReActiveAndroid Version: 1.4.3

I am migrating from ActiveAndroid where I used to build a database dynamically and set the database file location using Configuration.Builder.setDatabaseName(name) to the external files directory (e.g. /sdcard/Android/data/ch.photrack.discharge/files/discharge.db). That way database file can be directly accessed by user for debugging and exporting.

Is there a way to change the default location of database file in ReActiveAndroid? If not, how can I preserve data in already existing ActiveAndroid database file located in external files directory when user updates app to the version with ReActiveAndroid?

How to use Foreign Key Constraints

I need to enable Cascade on Delete in my database. I was wondering if that would be the default behaviour but I guess it doesn't matter if I didn't specify a Foreign Key in my class. Also, the Relationship part is missing in the documentation.

Is there any option to query database and get output in Cursor data?

Thanks for using ReActiveAndroid but before you post an issue, please consider the following points:

  • Please include the library version number, including the minor and patch version, in the issue text.

  • If you think you found a bug, please include a code sample that reproduces the problem. Dumping a stacktrace is usually not enough for us.

ReActiveAndroid cannot verify the data integrity - Crash Error

Hi,

I have an issue with adding columns then updating the version number as I get the below log error (and crash)

Caused by: java.lang.IllegalStateException: ReActiveAndroid cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.

I do update the version number & remove .disableMigrationsChecking() but still get crashes on launch.
Prior to the changes the application DB interactions work as intended.

How to hide single row in table

Thanks for using ReActiveAndroid but before you post an issue, please consider the following points:

  • Please include the library version number, including the minor and patch version, in the issue text.

  • If you think you found a bug, please include a code sample that reproduces the problem. Dumping a stacktrace is usually not enough for us.

Use select without id query

Aiming to get results from a query using just the below without passing an id, as the docs state .where() needs a id as first param ...

"The second parameter is to pass the query arguments"

Note note = Select.from(TodayInfo.class).where("title = LIKE '?%'", query).fetchSingle();

I am also getting the below error even with straight up docs example ..

E/SQLiteLog: (1) near "'?%'": syntax error

.exists() method

Is there .exists() method in ReActiveAndroid like there was in ActiveAndroid? Maybe under a different name? Thank you in advance

com.reactiveandroid.internal.database.table.SQLiteType.getName() on a null object reference

This is my first comment so sorry if it isn't structured the way it should.

Im using a model with a costume variable with the type org.joda.time.DateTime, i've added a costume serializer for this type but im getting a NullPointerException. This Exception occurs on line 95 in the SQLiteUtils.java file and it's because the type of the column is null.

I think the problem has to do with line 45 and 46 in the file DatebaseInfo.java, the custom serializers are loaded after the models. Can you verify this or am i doing something wrong?

DatebaseInfo.java

public DatabaseInfo(Context context, @NonNull DatabaseConfig databaseConfig) {
        loadModels(context, databaseConfig); //These two lines
        loadTypeSerializers(databaseConfig); //These two lines

        this.reActiveOpenHelper = new ReActiveOpenHelper(context, databaseConfig, tableInfos.values());

        ReActiveLog.i(LogLevel.BASIC, "Tables info for database " + databaseConfig.databaseName + " loaded.");
}

My Serializer class:

public final class DateSerializer extends TypeSerializer<DateTime, Long> {

    @Nullable
    public Long serialize(@NonNull DateTime date) {
        return date.getMillis();
    }

    @Nullable
    public DateTime deserialize(@NonNull Long date) {
        return new DateTime(date);
    }
}

Console output:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.MyApplication.halloworld, PID: 30708
                  java.lang.RuntimeException: Unable to create application com.MyApplication.halloworld.config.MyApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.reactiveandroid.internal.database.table.SQLiteType.getName()' on a null object reference
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5794)
                      at android.app.ActivityThread.-wrap1(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
                      at android.os.Handler.dispatchMessage(Handler.java:105)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.reactiveandroid.internal.database.table.SQLiteType.getName()' on a null object reference
                      at com.reactiveandroid.internal.utils.SQLiteUtils.createColumnDefinition(SQLiteUtils.java:95)
                      at com.reactiveandroid.internal.utils.SQLiteUtils.createTableDefinition(SQLiteUtils.java:69)
                      at com.reactiveandroid.internal.database.ReActiveOpenHelper.createAllTables(ReActiveOpenHelper.java:107)
                      at com.reactiveandroid.internal.database.ReActiveOpenHelper.onCreate(ReActiveOpenHelper.java:35)
                      at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:294)
                      at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:194)
                      at com.reactiveandroid.internal.database.DatabaseInfo.getWritableDatabase(DatabaseInfo.java:65)
                      at com.reactiveandroid.internal.database.DatabaseInfo.initDatabase(DatabaseInfo.java:55)
                      at com.reactiveandroid.ReActiveAndroid.init(ReActiveAndroid.java:64)
                      at com.MyApplication.halloworld.config.MyApplication.onCreate(MyApplication.java:37)
                      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
                      at android.app.ActivityThread.-wrap1(Unknown Source:0) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661) 
                      at android.os.Handler.dispatchMessage(Handler.java:105) 
                      at android.os.Looper.loop(Looper.java:164) 
                      at android.app.ActivityThread.main(ActivityThread.java:6541) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

Data integrity crash

ReActiveAndroid Version: 1.4.3

Bug or Feature Request: Got a data integrity crash after updating data model and database version

Description:

java.lang.IllegalStateException: ReActiveAndroid cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.
        at com.reactiveandroid.internal.database.ReActiveOpenHelper.checkIdentity(ReActiveOpenHelper.java:71)
        at com.reactiveandroid.internal.database.ReActiveOpenHelper.onOpen(ReActiveOpenHelper.java:51)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:411)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:298)
        at com.reactiveandroid.internal.database.DatabaseInfo.getWritableDatabase(DatabaseInfo.java:65)
        at com.reactiveandroid.ReActiveAndroid.getWritableDatabaseForTable(ReActiveAndroid.java:131)
        at com.reactiveandroid.internal.utils.QueryUtils.execSQL(QueryUtils.java:27)
        at com.reactiveandroid.query.ExecutableQueryBase.execute(ExecutableQueryBase.java:21)

I deleted a field from my model, and incremented the database version:

@Database(name = "propertyforce", version = 19)
public class AppDatabase {

It was 18 before. Here's how I'm initializing:

DatabaseConfig appDatabase = new DatabaseConfig.Builder(AppDatabase.class)
                        .addModelClasses(LogEntry.class, FarmReport.class, FarmReportProperty.class)
                        .disableMigrationsChecking() // Potentially destructive, so replace with migrations if adding any tables that need to persist
                        .addTypeSerializers(JsonSerializer.class)
                        .build();
                ReActiveAndroid.init(new ReActiveConfig.Builder(context)
                        .addDatabaseConfigs(appDatabase)
                        .build());

So I shouldn't need any migrations. Why is this happening?

How to select distinct records

Hi dear,

How can I select distinct in ReActiveAndroid, I'm trying to select this way but it requires Object as parameter but not model class

Select.distinct().from(...)
I'm using version 1.4.3
Thanks

Please review commits to Forked version of master Branch

@ImangazalievM below for your review/rejection/advice

Thank you for contributing to ReActiveAndroid. Before pressing the "Create Pull Request" button, please consider the following points:

Please give a description about what and why you are contributing, even if it's trivial.

  • Added API Fuctionality for Transactions & Pagination with sample activites (and subsequent adapters, layouts, menus, values, manifest) within reactiveandroid\sample-app

  • For review by repository owner

  • Review at bhapps@b40e96c

Please include the issue list number(s) or other PR numbers in the description if you are contributing in response to those.

Please include a reasonable set of unit tests if you contribute new code or change an existing one.

  • None added, but provided within reactiveandroid\sample-app

Order List

I am displaying notifications in a recyclerview and would like to order it by showing the newest notification on top. I've tried using orderBy("timestamp"), but it orders it from oldest to newest. timestamp is saved as a long which is basically me saving System.currentmillis() whenever a new notification is received. How can I reverse the current ordering?
notificationses = Select.from(Notifications.class).orderBy("timestamp").fetch();

Use multiple Where clauses when using fetch()

ReActiveAndroid Version:
latest

Bug or Feature Request:
Use multiple Where clauses when using fetch()

Description:
There is still an issue where I wish to return all (or paginated) data filtered by the query using fetch() which returns the error of Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters

All the documentation advises only of using fetchSingle() when using multiple Where clauses
I wish not to return only the first hit, but all (or some) data items.

  • Maybe fetch() has not been implemented for using multiple Where clauses
  • fetch() with multiple clauses would require List<> return type

Multiple Where clauses not working?

ReActiveAndroid Version: 1.4.3

Bug or Feature Request: Multiple WHERE clauses in query

Description: I'm trying to migrate from ActiveAndroid to REActiveAndroid but having some problems with multiple WHERE clause migrations.

The old way to do it in AA was like:
Note note = Select.from(Note.class).where("noteId = ?", username).where("noteContent= ?", content).fetchSingle();

Now, according to this migration guide: https://imangazalievm.gitbooks.io/reactiveandroid/migration-from-activeandroid.html we're supposed to do it this way:

List<Note> notes = Select.from(Note.class).fetch();
List<Note> notes = Select.from(Note.class).execute();
Note note = Select.from(Note.class).where("id=? AND title LIKE '?%'", 1, "Hello").fetchSingle();

There's several problems with this. First, "notes" is defined twice, Second ".execute();" cannot be resolved by Android Studio, and third (and perhaps most importantly) when I build it like the tutorial states, I get:
java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters.

Why this change? What should I do to fix it?

Pass Data and Set All Data

ReActiveAndroid Version:
Latest
Bug or Feature Request:
Feature

Description:
Be able to pass set data to Method to update all values passed, which would save many manually written hard-coded methods within app;

Would tie in nicely with Transaction API as you could pass all this and use transaction via one API call

Example:

fetch data from server and set data like below;

//set temp model data in activity/fragment/service/response
Note myModelUsedForReActiveAndroid = new Note();
dataHolder.setTitle("title from server");
dataHolder.setText("text from server");
dataHolder.setUpdateAt("date from server");

updateViaCRUD(Note.class, dataHolder );

then pass to API to process an do CRUD in one action;

public static Boolean updateViaCRUD(Class<?> table, Model<?> myModelUsedForReActiveAndroid) {

boolean result = false;
//check if data item already exists
//update all values or;
//create new values 

//if save success
//result = true;

return result;

}

How to make date functions ?

Ex.

CREATE TABLE `Example` (
	`id`	INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
	`timestamp`	**DATETIME DEFAULT CURRENT_TIMESTAMP**
);

How can I create a table like the one above?

Usage with existing database

I have just migrated from ActiveAndroid due to errors on Android 8+

The problem is that my app comes with db-first approach. The database, which has all the tables and data, gets installed with app. In ActiveAndroid I used to have my db in assets folder and it would handle the else correctly. However after migration the fetch commands return empty. I think the db file in assets is not used and ReActiveAndroid just creates a new one.

The filename is in 'mydatabase.db' format and my appdatabase.js:

@Database(name = "mydatabase", version = 1)
public class AppDatabase {
}

So is there something that I'm missing?

Proguard - Primary key field not found for model

After proguard rules this is error
my proguardrules:
#ReActiveAndroid
-keep class com.reactiveandroid.** { *; }
-keep class com.reactiveandroid.. { *; }
-keep class * extends com.reactiveandroid.Model
-keep class * extends com.reactiveandroid.serializer.TypeSerializer
-keepattributes Column
-keepattributes Table
-keepattributes PrimaryKey
-keepattributes Unique
-keepattributes Annotation
-keepclassmembers class * {
@fully.qualified.package.AnnotationType *;
}
E/CrashlyticsCore: Failed to execute task. java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(FutureTask.java:177) at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBackgroundWorker.java:41) at com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:320) at com.crashlytics.android.core.CrashlyticsController$6.onUncaughtException(CrashlyticsController.java:300) at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:42) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) E/AndroidRuntime: FATAL EXCEPTION: main Process: np.com.sahsantosh.shareExpense, PID: 15633 java.lang.RuntimeException: Unable to create application np.com.sahsantosh.shareExpense.common.ApplicationClass: java.lang.IllegalStateException: Primary key field not found for model Category at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4973) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5765) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:683) Caused by: java.lang.IllegalStateException: Primary key field not found for model Category at com.reactiveandroid.internal.database.table.TableInfo.findPrimaryKeyField(TableInfo.java:187) at com.reactiveandroid.internal.database.table.TableInfo.<init>(TableInfo.java:70) at com.reactiveandroid.internal.database.DatabaseInfo.createTablesInfo(DatabaseInfo.java:153) at com.reactiveandroid.internal.database.DatabaseInfo.loadModels(DatabaseInfo.java:130) at com.reactiveandroid.internal.database.DatabaseInfo.<init>(DatabaseInfo.java:45) at com.reactiveandroid.ReActiveAndroid.init(ReActiveAndroid.java:53) at np.com.sahsantosh.shareExpense.common.ApplicationClass.onCreate(ApplicationClass.java:47) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1018) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4970) at android.app.ActivityThread.-wrap1(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560)  at android.os.Handler.dispatchMessage(Handler.java:111)  at android.os.Looper.loop(Looper.java:207)  at android.app.ActivityThread.main(ActivityThread.java:5765)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:683) 

Unable to update Mulitple Data at that time 1.4.2

Thanks for using ReActiveAndroid but before you post an issue, please consider the following points:

  • Please include the library version number, including the minor and patch version, in the issue text.

  • If you think you found a bug, please include a code sample that reproduces the problem. Dumping a stacktrace is usually not enough for us.

How to retrieve Model IDs?

Hi,
I'm currently migrating an app from ActiveAndroid to ReActiveAndroid. One of the issues I've run into is the lack of a getId() method from the Model class that was present in ActiveAndroid. Some of my Model classes rely on this method. Is there some other way to retrieve the Model ID inside a Model class?

Any help would be appreciated, thank you.

open existing db

Thanks for using ReActiveAndroid but before you post an issue, please consider the following points:

  • [1.4.3]

I need to create a DB every day. How can I do it?
And how can I open DB created in past days?

THanks

E/SQLiteLog: (1) near "LIMIT": syntax error

I am using fetchSingle() to check if any hits (via "id", 1) and get hit with E/SQLiteLog: (1) near "LIMIT": syntax error when processing (I know no rows in related queried table) but should return 0 or a false value but instead get Exception error ...

Any advice?

Error on async select

I'm using Kotlin. I got this error:

02-14 13:36:57.260 23657-23692/<> W/System.err: io.reactivex.exceptions.OnErrorNotImplementedException: Database info referenced with table <>.shared.models.ReportEntry not found.
02-14 13:36:57.260 23657-23692/<> W/System.err:     at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.observers.ConsumerSingleObserver.onError(ConsumerSingleObserver.java:47)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onError(SingleSubscribeOn.java:73)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:48)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:463)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
02-14 13:36:57.261 23657-23692/<> W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at java.lang.Thread.run(Thread.java:764)
02-14 13:36:57.262 23657-23692/<> W/System.err: Caused by: java.lang.IllegalArgumentException: Database info referenced with table <>.shared.models.ReportEntry not found.
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.ReActiveAndroid.getDatabaseForTable(ReActiveAndroid.java:120)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.ReActiveAndroid.getTableName(ReActiveAndroid.java:186)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.query.Select$From.getPartSql(Select.java:181)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.query.QueryBase.getSql(QueryBase.java:19)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase.fetch(ResultQueryBase.java:26)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase$1.call(ResultQueryBase.java:57)
02-14 13:36:57.262 23657-23692/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase$1.call(ResultQueryBase.java:54)
02-14 13:36:57.263 23657-23692/<> W/System.err:     at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
02-14 13:36:57.263 23657-23692/<> W/System.err: 	... 10 more
02-14 13:36:57.264 23657-23691/<> W/System.err: io.reactivex.exceptions.OnErrorNotImplementedException: Database info referenced with table <>.shared.models.ReportEntry not found.
02-14 13:36:57.264 23657-23691/<> W/System.err:     at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
02-14 13:36:57.264 23657-23691/<> W/System.err:     at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
02-14 13:36:57.264 23657-23691/<> W/System.err:     at io.reactivex.internal.observers.ConsumerSingleObserver.onError(ConsumerSingleObserver.java:47)
02-14 13:36:57.264 23657-23691/<> W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onError(SingleSubscribeOn.java:73)
02-14 13:36:57.264 23657-23691/<> W/System.err:     at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:48)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:463)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
02-14 13:36:57.265 23657-23691/<> W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at java.lang.Thread.run(Thread.java:764)
02-14 13:36:57.266 23657-23691/<> W/System.err: Caused by: java.lang.IllegalArgumentException: Database info referenced with table <>.shared.models.ReportEntry not found.
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.ReActiveAndroid.getDatabaseForTable(ReActiveAndroid.java:120)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.ReActiveAndroid.getTableName(ReActiveAndroid.java:186)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.query.Select$From.getPartSql(Select.java:181)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.query.QueryBase.getSql(QueryBase.java:19)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase.fetch(ResultQueryBase.java:26)
02-14 13:36:57.266 23657-23691/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase$1.call(ResultQueryBase.java:57)
02-14 13:36:57.267 23657-23691/<> W/System.err:     at com.reactiveandroid.query.ResultQueryBase$1.call(ResultQueryBase.java:54)
02-14 13:36:57.267 23657-23691/<> W/System.err:     at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
02-14 13:36:57.267 23657-23691/<> W/System.err: 	... 10 more
02-14 13:36:57.267 23657-23691/<> I/Process: Sending signal. PID: 23657 SIG: 9

I have the following code:

Select
                .from(ReportEntry::class.java)
                .fetchAsync()
                .subscribeOn(Schedulers.io())
                .subscribe { reportEntries ->
                    entries.addAll(reportEntries.filter { it.date.monthOfYear == month }
                            .sortedBy { it.date })
                }

How to distinct select record

ReActiveAndroid Version:
1.4.2
Bug or Feature Request:
this is below my code but can not distinct records solve my problem
Description:
public static List getRyotMasterList() {
return Select.distinct().columns("mobile_1").from(RyotMasterDb.class).orderBy("remoteID DSC").fetch();
}
mobile_1---> this is the column name . kindly check my code

TypeSerializer does not support byte[] ?

TypeSerializer.java
raise an exeption if I use byte[] as SerializedType
this.serializedTypeClass = (Class) parameterizedType.getActualTypeArguments()[1];

how to serialize into byte[] ?

Sample App - Error with open_folders_edit_screen

ReActiveAndroid Version:
latest
Bug or Feature Request:
Bug in Sample App when tapping on open_folders_edit_screen
Description:
App crash when tapping icon (open_folders_edit_screen) in Toolbar.

  • Crashes due to Items datasource is null!

04-14 09:09:00.235 1947-1947/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.reactiveandroid.sample, PID: 1947 java.lang.NullPointerException: Items datasource is null! at com.hannesdorfmann.adapterdelegates3.AdapterDelegatesManager.getItemViewType(AdapterDelegatesManager.java:215) at com.hannesdorfmann.adapterdelegates3.AbsDelegationAdapter.getItemViewType(AbsDelegationAdapter.java:87) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5549) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5482) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5478) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2215) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1542) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1502) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3625) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3354) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3886) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344) at android.widget.FrameLayout.onLayout(FrameLayout.java:281) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:434) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344) at android.widget.FrameLayout.onLayout(FrameLayout.java:281) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344) at android.widget.FrameLayout.onLayout(FrameLayout.java:281) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:3193) at android.view.View.layout(View.java:17938) at android.view.ViewGroup.layout(ViewGroup.java:5812) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2666) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2367) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1437) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7397) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) at android.view.Choreographer.doCallbacks(Choreographer.java:695) at android.view.Choreographer.doFrame(Choreographer.java:631) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Using Transaction for large Data ~15k entries

Current Version: com.reactiveandroid:reactiveandroid:1.4.3

I have, on launch a scenario of comparing local string & server side string, and on false, I run an update to my DB which has data pulled from API (~15k items) in which I pass this data to public static helper to do DB updates on the tables;

Problem is when I use begin/end transaction in this method(), even though the save() passes true, nothing gets actually added or updated (get count of 0), but if I remove the begin/end transaction everything gets updated/created in the DB as i should (get count of ~15k) but is very slow and not ideal at all;

Also both types freeze the UI indefinitely until task completed;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.