Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 12 months ago.
Improve this question
Android ListView with SimpleCursorAdapter, takes time to display ListView for a large DataSet (for around 7000 records) . Is there anyway to optimize it?
From the log it look like getting the cursor is taking around 4-7 seconds. Let me know if anyone has a solution for this?
A few ideas:
Display data one page at a time. When you scroll down, load more data.
Scrolling through 7000 records to go to the end will take forever. Access your data via a search form. Limit results to 100 records.
If the data is sorted, group items together and provide an index. For example, alphabetical lists can be split into 26 subsets. The first page shows the alphabet, and you have to click on a letter to go to a subset.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
My RecyclerView by defaults shows items sorted by name (that's how they come out of the database). I'am offering 4 additional sort options in the action bar for the users. I'm thinking of having 5 lists in the RecyclerView one for each sort and another list (just a reference) to point to the current list. When new data arrives the lists get sorted appropriately and when the user selects a sort order the current list gets the appropriate value and I call notifyDataSetChaged(). Is this a reasonable approach?
You don't need to have multiple lists one list is enough.
You just have to order it as you want then replace it in your adapter then call notifyDataSetChanged()
To sort your data you can use Comparator like in here :
How to sort an ArrayList in Java
Hope it helps
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am new in android development. An interviewer asked me a question that how would you set the large amount of data on a spinner. Data is on server which is very large, for example one million strings. How would you set in on a spinner so that user doesn't have to wait much in order to load that data?
I try to find this kind of question here but i didn't get expected answer so i have posted here.
you can store large amount of data in arraylist, ArrayList in Java has a get(int index) method. int is a signed 32 bit value, with a maximum value of 2,147,483,647. You can therefore store about 2.14 billion records in an arraylist.
then you can display arraylist in spinner recycleview. The RecyclerView is much more powerful, flexible. it doesn't freezes the UI. It supports the use Viewholder pattern and can contains 100k+ rows it runs very smooth.
Simply implement pagination and load the data in chunks. If the API isn't enhanced for pagination, download the strings and set them to an ArrayList, then paginate the array by looping through and receiving the data
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to create big forms in an Android applications, with a lot of questions and inputs, what is the best way to do that ? Did I need to user Scroll View, List View ? If it's a List View what kind of adapter is the best ?
Generally, it is not a good idea to present a huge form on a single page on a mobile device. Users don't like to scroll pages after pages of views to fill forms. It can be disorienting and hard to navigate. On smaller devices, things will be even worse.
Consider breaking a big form down by functional areas and present a smaller UI instead. This will make it easier for the user. You could organize your form in a view pager where you can have several pages.
My experience with ListView (this may apply to RecyclerView too) is that adding an edit field to a row has some challenges in terms of handling focus, touch events etc. The listView does not handle it very smoothly. So it is possible to use these but it can be tricky. Unless there are lots of similar rows, listView does not give you much. Doing a ScrollView or a TableLayout will be fine.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
To put a lot of searchable text in a software, what would be the best method, database or File-Handling system? Keeping in mind that the text is an Asian language with right-to-left orientation. Platform is Windows and Android.
Database is the better option. It has structured format of all your stored datas. Database allows you to fire queries and search for a particular text you want. You can store and fetch data very easily and with good performance speed. You can also delete any unwanted texts which is easy part.
Now incase of File, It is unstructured format kind of data. All your data gets stored below one another in line by line or. Fetching a particular word from bunch of whole paragraph is tedious job. Even You need to hold whole file's object all the time, which occupies more memory.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Currently in the app I'm working on as an ongoing project we have a limit of 100 comments per item.
Items can be stuff like forums, journals, and many more stuff. Some of these items are pretty custom and are added to a ScrollView instead of a generic Listview.
Now one client wants to be able to see even more comments since he needs to keep reading for his research.
What would be a good or even a better option could someone advise? What I"m thinking off now are the following.
At the end of our limit, add an "Show all comments" button which loads a simplified listView containing all the comments.
This way avatars will be easely hidden when not visible etc.
Pagination, load the next hundred by using pagination.
You should use a ListView in the first place because the views will get recycled and will not consume all the memory like the scrollView is doing