p32929/EasiestSqlLibrary

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

Closed this issue · 14 comments

I have Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
on

        EasiestDB easiestDB = EasiestDB.init(this);
        Cursor cursor = easiestDB.getOneRowData(0, 0);
        if (cursor != null) {
            SQlite SQlite = new SQlite();
            SQlite.execute();
        }

How i can check if DB is null and insert data?

And this method

EasiestDB easiestDB = EasiestDB.init(Load.this);
                            easiestDB.addDataInTable(0,
                                    new Datum("store_id", store_id),
                                    new Datum("keywords", keywords),
                                    new Datum("telephone", telephone),
                                    new Datum("latitude", latitude),
                                    new Datum("longitude", longitude),
                                    new Datum("store_desc", store_desc),
                                    new Datum("store_name", store_name),
                                    new Datum("category_id", category_id),
                                    new Datum("auth_id", auth_id)
                                    );

Return java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 on easiestDB.addDataInTable(0,

When I first start, I need to fill out the table with data from FireBase.And on one first activity I get all the data, on the second activity by the store ID. How to do it?

Can you contact me via facebook?
https://www.facebook.com/p32929

You issue doesn't seem to clearly describe the problem.

Can you contact me via facebook?
https://www.facebook.com/p32929

You issue doesn't seem to clearly describe the problem.

Oh,i dont use FB,it not popular in Russia xD

I perfectly used your V1 but there was a problem with getting one record by store id
p32929/AndroidEasySQL-Library#5
I closed it because I thought you would send it to the V2 library. But v2 does not work for me according to the instructions

It seems, I made a mistake in the documentation. Row number starts from 1
TIP:
in this library, every variable name that contains "index" starts from 0 and every variable name that contains "number" starts from 1
I'll update the doc today. Please, let me know if its fixed. and if not, tell me any social network where we can talk and share screen so that I can identify the problem. thanks

Just updated the documentation

image
I want to make that if the database is empty, I load data into it.
image
So I create two bases for stores and photos

It seems, you're doing it wrong brother. You need to use if (cursos != null). Seems, its not a problem of the library...
80495372-7d50a100-8970-11ea-9a05-d111e823419f

No,i need check if cursor == null i add data from Firebase to sql
I need to check if the user has a database.
If not, I create and fill it.

This way its gonna take a very long time.
Do you have skype, whatsapp, or any messaging service that supports voice calling?
I really want to fix the issue if it really exists

Yes i have whatsapp&skype but in English I can only through Google translator)) I speak poorly and understand by ear

Now my check is SharedPref
image
My DB create and upload data to it
image
My test log get all data

        EasiestDB easiestDB = EasiestDB.init(this);
        Cursor cursor = easiestDB.getAllDataFrom(0);
        if (cursor != null) {
            while (cursor.moveToNext()) {
                String row = cursor.getString(3);
                String id = cursor.getString(0);
                String c1 = cursor.getString(5);
                Log.e("DataBase", "row  " + id + "  ID: " + row + " Имя: = " + c1 + "\n");
            }
        }

My error:

 Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.get(ArrayList.java:437)
        at org.richit.easiestsqllib.EasiestDB.getAllDataFrom(EasiestDB.java:149)
        at com.box.a100rados.Activity.MainActivity.onCreate(MainActivity.java:77)

on line Cursor cursor = easiestDB.getAllDataFrom(0);

No problem. I speak with a lot of people who speak poorly in English. So, its fine. Here's my whatsapp: https://api.whatsapp.com/send?phone=8801796306262
Ping me whenever you're available/free

It seems, the problem was in your code, not in the library itself. So, I can close the issue now. right?