I want the autocomplete view to display multiple items for the same text item.
ie. with an input data, {{a,b,c,d}, {e,f,g,h}} the user could search and start typing in b, but only 1 item from a,b,c,d would be displayed in the autocomplete section.
How would I go about this?
Thanks
I found I could solve this problem by adding all the elements to the autocompletetextview like normal
However, for the items that had "aliases" I put them in as 1 item, separated by a separator character and a space. The space allowed the item to be selected using the normal functionality. Then I used a custom view for each of the items which identified which 'part' of the string was being entered and displayed that part in the dropdown item.
For my solution, I then hide the autocompletetextview, but you could also just call setText to overwrite the default behavior.
Related
I have a listview with custom adapter, and I have a edittext for input search. What I want to achieve is to get the item position from a listview that matches with the string from the edittext.
All the examples on the web shows how to get the item position of a listview onclick event. But I can't figure it out how to do this my given query above. Any input is appreciated very much
Try setting the text as content description to the view. Use findViewsWithText(constraintString). Make sure other views do not have same content description because ListView will only bind data to existing views, which previously might have holded this content description and you would end up getting incorrect view ref.
If I understand what you need, take a look at the AutoCompleteTextView here.
This will display a mini list, below the EditText box, of strings that match what the user is typing. The user will then be able to select the item from the AutoComplete list which will invoke a method that passes you all kinds of info on the list item itself.
This all assumes that you are using a List<String>, ArrayList<>, or some other string Collection.
Sorry if I didnt help, give us more info on what exactly you need it to do.
I am working on a UI where I have a list view. Each row has 2 information. One is Product name and the other is product ID stacked one over other. So each row has 2 lines of data.
What i want to do with this:
Once a user clicks on each row, it will further expand and show one input and one spinner. So it is basically for putting in Quantity and unit of measure.
Please let me know if this is achievable and if I can refer to some example.
What I need is more like
Taskos To Do List | Task List
https://play.google.com/store/apps/details?id=com.taskos&hl=en
All i need is that the category will not be expandable. Only the items will be expandable. All i need is an example of such app and then I can take it forward.
I think it could be done... you would need to put the extra widgets in your row layout, populate them and hide them upon list creation, then in your onListItemCLick you could unhide them.
Note I have no idea if this would work, but it seems reasonable that it might and it's what I would try and do to achieve the goal.
listView cannot be expanded. however you can use an expandablelistView
But the kind of functionality you want cannot be done this way(I guess.).
You can use
registerForContextMenu("your list View");
to register your list view
onCreateContextMenu
for the kind of action you want to be performed in your case its dialog with EditText and Spinner to have input from user
I have a ListActivity that presents a list of names from a database using a SimpleCursorAdapter. I want the user to be able to select 1 or more names by clicking them and then proceed to the next Activity. This should be a toggle, so that if the user clicks a selected name it will become de-selected. The underlying code is working fine, the problem is how to show the user which items are currently selected.
I looked at this solution: Android how to highlight a selection in a list and tried toggling .setSelected() on the TextView for the name. The problem is that the "selected" state apparently can only be true for one item in a list at a time. So if the user touches "Alice" then "Bob," only "Bob" will show as selected. Any thoughts on the best way to have a toggle-able highlight for multiple list items?
Have a look at the setChoiceMode method of the AbsListView class and its possible CHOICE_MODE_MULTIPLE parameter value.
In my Android app, I have this screen where the top part is a search box kind of thing and below it there is a ListView. Now the requirement is that when a user starts typing something in the search box I have push up items from the list view which match that pattern.
I have thought of using Auto Complete TextView, but that does not help because the items displayed must be in the list view itself where they can be clicked. They just need to be pushed up the list when they match the pattern of text typed in the Search box above.
How to achieve this ?
Please Help.
use addTextChangedListener in EditText to get user interactin with EditText and update the ListVIew using notifyDataSetChanged();. Try to use Handler
I want to display a list item that says "More" at the end of my ListView. Clicking on this list-item will perform some action. How can I create this "more" list item?
I don't know about the "Clicking on this list-item will perform some action" part. The typical pattern is that once the user scrolls to the bottom, new material is loaded automatically. Some people do that by detecting the scroll. I do it by putting in a "More" placeholder and detecting when that is used. Here is a component that implements this pattern.
Just add another value to your arrayadapter (or any other adapter), you might be using.set the text to 'more' .
Suppose you have n items in the list then handle the (n+1)th postion click and do your stuff.
You can add a footer to your listview...
Did you check this post out?
Android ListView Footer View not being placed on the bottom of the screen