6

I am new to android and in my app I have to fetch heavy data from server (out of which two are images) and store it in local database. Till now, I have done standard way which involves fetching all data at once and storing it in local database. But I am getting out of memory error. Is there any guidelines which I need to follow while fetching heavy data? Also I am storing images in local database in blob form.

Rahul
  • 367
  • 2
  • 6
  • 27
Scan Game
  • 69
  • 1
  • 7

1 Answers1

2

I think this is because query results are too large for the cursor's window and it requests more memory or caused because of blob image .

Since your requirement met using endless scroll or infinite scroll I recomment to use that .

And best way to store image is to store path in DB and store image in SD card

You will get reference from following link to implement infinite scroll view using recycler view

http://android-pratap.blogspot.in/2015/06/endless-recyclerview-with-progress-bar.html

Rahul
  • 367
  • 2
  • 6
  • 27
  • is there any way to achieve it through json? nd srry for late response – Scan Game Feb 08 '16 at 10:59
  • could you please tell me what is your actual use case – Rahul Feb 08 '16 at 11:09
  • ok. all i want to do is fetch heavy data from server (which includes text data as well as images ) and store it in local database which i need to display in listview. – Scan Game Feb 08 '16 at 11:13
  • There is an option of infinite scroll in android list view where you can bring data on demand in list view ( a kind of pagination ). Will that meet your requirement – Rahul Feb 08 '16 at 11:17
  • i kow concept of infinite scroll. but now i havent used this concept yet . is it bcoz of that i am getting "window is full error" – Scan Game Feb 08 '16 at 11:25
  • Inserting too many row to sqlite in single transaction will throw the mentioned error . You can try multiple transactions for the insert. – Rahul Feb 08 '16 at 11:30
  • now u get my problem. so can u elaborate way to achieve this or give an example? – Scan Game Feb 08 '16 at 11:31
  • I think this example will help you . Let me know if you face any problem http://android-pratap.blogspot.in/2015/06/endless-recyclerview-with-progress-bar.html – Rahul Feb 08 '16 at 11:34