I have an ArrayList which has over 15000 Strings which is a line and I am displaying the results with their search words which are displayed using ArrayAdapter but it takes about 6-8 sec to search through the whole ArrayList. Is it possible to make it quicker or at least view the results that are already found and keep the searching continue at the background. Below is the link where I posted the question in detail. I really need help on this any help would be appreciated.
https://stackoverflow.com/questions/20150994/android-how-to-make-searching-initials-of-the-words-from-a-line-in-textfile-fas
I think you need a filterable listview for searching, look this example: List View Filter Android
There are many tips to improve search performance. And you should wrap your data into a model instead of many strings then override equal method for compare two object for searching.
Hi given the use case I under stood that you are searching for the content from a file
which is containing 15,000 lines when user types in the text box. ArrayList is the
efficient data structure to use for search purposes. so the only solution is to divide the
file in to smaller chunks and base on the input read from the expected file and display
the content.
for example:
Pseudo code:
if user types for initials stars with a search in one file
else if user types for initials stars with b search in one file
........................................
........................................
based on use case
else
default file
try in this way check whether performance improves
Related
Sorry for the basic question, but after a long time searching, I still don't know what to call this...
What do you call the list of items to display like this picture, (the addresses in the to section), each item is in a tag, and they will fill up the screen according to the screen size and content of the item.
I want to search about how to do this in the best way, but I'm not sure what to search for. What are these "tags" called?
Thanks so much.
What you are looking for is known as Chips . This component represent complex entities in small blocks, such as a contact/email address etc.
I'm attaching a Material design link where you can explore detailed information about them, their types and behaviour.
You can use below libraries to achive it.
https://github.com/pchmn/MaterialChipsInput
https://github.com/klinker41/android-chips
Let I have some number n. It can be equal to any integer number ranged between 2 and 15,for example. And according to this number, I need to show n TextView's(orButtons). I need this concept for creating kind of 4 pic 1 word quiz game. As you know, in this game , if secret word is banana,then app create 6 places for each letter. And my question is what kind of concepts to use in order to solve this problem? My idea for solution was following: creating some view and add to this view a TextView n times. But I don't think that it is right way to do that. Can you tell me what I have to use in order to achieve my goal?
Loads of ways to achieve this:
You couid just create the placeholders you want in an XML Layout, I would of thought EditText with maxLength=1 and then use .setVisibility to show the ones you need depending on question;
You could use a loop to generate the number of elements you want. See
here for code example
I'm building an app with linear and relative layouts to create lists. I want to have a search function to search through text fields and return the results with "links" to the pages it pulls the results from.
I don't know if I am explaining this well enough, but that's what I need help with. I can find all sorts of search help but it all seems to revert back to ListView's.
You should aim to create your "lists" from some form of data-store. Usually a database, see SQLite Databases in Android. You should then use the query language to return only fields that match your search term e.g. "SELECT * FROM people WHERE name = 'Adam'".
To directly answer your question, the searching of text fields (EditText's or TextViews) is not possible to do automatically and you would need to hard code the search for each individual one.
I am using MIT App Inventor 2 and I am trying to make my search box more useful.
Right now a have a bunch of lists and it only works if the words in the "search" textbox match the word in the list exactly. I want it to be more dynamic. For example
If someone puts oj container in the search box I want it to search the lists for oj container and if that does not come up with anything then search the lists for both oj and container separately. And if it finds one of these words in the list to follow on to the next action, which is to open up the appropriate page.
So far my code looks like this:
Tell me if this code make sense. Thanks.
Here are some more code screenshots
No, it does not make sense. The split at spaces block returns a list and using the is in list? block you can't search for a list of things, only for a "thing" (a single word in your case). Therefore you will have to search for each single word in your list using a for each item in list loop.
Also there is some redundancy in your blocks. If searching for oj container is successful, the search for oj also is successful, which means, you can remove the blocks to search for the complete sentence...
See my solution for the first part of your screenshot.
I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.
For example: i type abc and i get completed, with the rest of the text in grey: abc1#etc.etc and then click a button to keep this text or keep writing to filter this even further.
Do you think is is achievable somehow?
I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.
Why don't you try to implement a custom view?
Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.
Have a look at:
TextWatcher in order to see how detect the user input and progress
You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.
One thing that I don't like about this idea is the fact that if you have got:
Germans
Germany
...
You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.
use below example ... i think help you...
http://teamandroid4u.blogspot.in/2012/06/autocompletetextview-example.html