My application must show data from a Csv File in RecyclerView.
I have everything set up and I set up also a function to read the Csv File, but I have a problem.
Since the Csv File is very large ( many thousand of rows ) when I try to show all the rows in the RecyclerView, app crashes.
How can avoid this?
Ah, I enter the data in a Room database.
This is my process :
ReadFile
Save it as List of List of String
Create my type objects for every row and create a List
Apply insertAll(input : List) to insert into Room Database
How can I manage this type of operation without slowing down or crashing the application?
Thanks everyone and good life :)
Best way to do that is by partitioning, load only 20 row each time or any number, when user scroll load another 20.
Related
Currently, I have three string-arrays in my String Resources that hold information I need for the application to start and function. These arrays need to be kept in order as string-array A position 5 corresponds to string-array B position 5 and so on.
This doesn't seem great as it can be error prone and not extensible if I want to add 100 new datapoints - so I have been looking into using a JSON file to store the data which seems to be better.
My problem: I have a Recycler View that is populated with data from my String Resources. Each item in the Recycler View is different, so the first view will take information from the first entry in string-array A, B and C and continue through each view in the Recycler View.
Is it better to create a JSON file that collects and groups the data so corresponding data is kept together? As well as reading this file into my SQLite database and create a cursor object that will populate my Recycler View and allow for some other database related activities later on in my application? From what I can tell it is.
Is this a viable solution to my problem?
Thanks
I'm using firebase database to store data. I know how to use firebase database.
In my project I've an activity which displays a list of notices from faculties to students and by clicking on list item it will open another activity which is a chat room. In this activity student can ask question related to given notice.
Now, In first list activity I've also added on text view which displays the total number of chat messages for that particular Notice. It works well when i load data from database initially. But i want to change number of chat messages dynamically.
So, i need to listnen at chat_cnt node to update value of message_cnt text view
and problem is it is a big list so i can not use child_added for each and every notice item and if i use value_event listener than it will load all data unnecessarily at start.
The code is a little bit big so i cannot post it here. But I've described the problem.
Any answer would be appreciated, thanks. Sorry for my english :)
I am quite new to Android development. I managed to get data saved to SQLite database. Now, what I want is to view these data when I call viewData(). I have viewData() which shows data as a Toast as I made it as a sample. Now I need these data to show on a new activity but the number of data to show is depending on how many data is in the database at the moment, If user saved 10 items then I want all the 10 items to shown up. How can I do it?
What is the best way to show data from SQLite database on an activity. Since I don't know to use ListView, I used TableLayout on the other activity where user feed data.
I hope my question is clear.
Thanks in advance.
I'm programming an Android app that shows data from MySQL database via ListView with some sorting:
1) Items that are closer to android phone by GPS are shown firstly
If there are 2 or more items with equal distance, second sorting parameter applies - time.
2) Items that are closer in time are showm firstly.
Here is a scheme of the process that I guess to implement:
My idea is to get all needed rows into Array, then make some PHP manipulations with it and then pull sorted Array to the phone.
(as shown on the image above)
So please advice me what will be the proper way?
Maybe there is easier method for this functionality?
Or maybe I should do all the sortings exactly in the Android app when programming ListView, getting only standard "SELECT *" array from the database? Then, is there an opportunity to create a ListView with sorting based on calculated values?
I am new to Android.I have stuck on one place,
I am fetching data from server that have thousand of records.I am using Limit 0,50 in my Query.SO it is showing only 50 records,But if I don't use Limit My application goes to crash.What should I do to show all my data in a List form.Is there any concept of Paging in Android or any other way.
Please suggest me the way.or links If anybody know it.
Thanks
save data fetched from server into db, using cursor to read data from db or set cache
Have you tried to use a customized list adapter ? In the getView method, use a combination of convertView + view holder, as explained here : http://chrislee.kr/wp/2011/01/01/making-the-android-ui-fast-and-efficient-by-romain-guy/