I would like to persist list item selection like it is on first picture(Circle Fragment Example), so when list item is selected it should stay marked as "selected". What I have is two different project I found on net. On first picture is behavior I want to achieve.
On second image(Fragment Basics) you can see that list item that has been selected do not persist "selected" state. What I don't understand is next:
In both case function that is being called is setItemChecked(position,true) but seems like different behavior is applied.
Check if on your second project the choice mode of your list view is set to choice_mode_single
And if the resource parameter of the ArrayAdapter is android.R.layout.simple_list_item_activated_1
Related
I have a list of items within a drop down on Gsheets.
I'd the default to be blank, and if another cell says 'Pending', I'd like the dropdown to automatically also say 'Pending'.
I'd also then like the user to be able to change the item with another option in the list.
I've tried choosing a data range with the function under data validation.
Basically I'd like the dropdown choices to be:
=IF(A2="Pending", "Pending", "")
In Progress
Done
Is this possible within Gsheets, or even using App Script?
I'd like the cell to default to blank, then change to pending based off another cell saying pending.
At the moment it doesn't seem to be dynamic in the sense that it updates when the chosen cell says Pending.
I have some json collection got from rest api, it defines various parameter types, like:
spinner with values collection (of string or some class objects with some fields)
date time field with date value
text edit field
set of check boxes (check box defined by id, name - caption, state checked/unchecked)
set of radio buttons
Each parameter is also named.
What I need: visualise list of items (each item will be one from types described above), let user to adjust values for each of them, retrieve collection (in the same json format) and post modified json to server.
Firs approach I've considered is to dynamically add controls to my layout inside scroll view, corresponding to item type. But I feel this is not good approach, maybe better to user RecyclerView and custom list.
Do you have any ideas how to construct list like that? Afaik Android RecyclerView assumes each list item to have the same layout, is it possible to get what I need?
This is something similar to what I had worked on. You'll need to create different viewholders and create types based on type of input required for each item in the collection.
In order to get the latest values user has entered, have them stored in the model class dedicated for the json response, map them and send them back to server.
Check this out :
https://guides.codepath.com/android/Heterogenous-Layouts-inside-RecyclerView
I had used TextWatcher to intercept changes made by user to edittext, checkchangelistener for radiobuttons, DateTimePicker with a textview to show date and time.
Use of textwatcher in edittext :
How to get the Edit text position from Recycler View adapter using Text Watcher in android
i have a jComboBox, it happens that i may have the same value for more than on item. In this case, when selecting one of them, , the selection goes always to the first item on the list. Right after the click.
Have someone experienced that?Have some solution for that, so the selection doesn't change?
When i select:
http://i.stack.imgur.com/IjlYM.png
Checking again:
http://i.stack.imgur.com/c1lcQ.png
it happens that i may have the same value for more than on item.
Then it sounds like you are adding a custom object to the combo box.
If it displays the same value but is a different item, then you need to implement the equals() method in your Object so the proper Object can be selected.
If you need more help then post a proper SSCCE that demonstrates the problem because we don't have enough information to keep guessing what you might be doing.
A JComboBox always tries to synchronize what is selected in the lists with what is shown in the display field. To do that, it searches the list sequentially for a match of the editor field. So it will always find the first one if there are identical items in the list. Thus you can't just use String objects if there is a possibility for identical Strings in the list. You need to do what #camickr said and use a custom object that has some way to distinguish between two objects whose toString() method returns the same thing (assuming you use the default model and editor).
I have a TableViewer where the values in one column should typically come from a dynamic list.
I'm currently using org.eclipse.jface.viewers.ComboBoxCellEditor , which is actually a Select-List: it stores the index of the selected value. If I change the underlying list (calling setItems(String[]), it's clumsy to keep the previous selected value... (specially if it's not included in the list anymore!) What I'd wish is actually a cell editor that stores, not the index from the list, but the string (perhaps letting the user edit it freely, perhaps not), where the list is just used as a suggestion at input time - like a "combobox" was supposed to work in the good old days... Is this possible?
I would suggest you to have your CellEditor to mimic the behavior that you are looking for. Extend ComboBoxViewerCellEditor and override doGetValue() method. Add modify listener on Combo control and also filter (which filters list items based on input text) to comboviewer.
You should look at :
org.eclipse.wst.xml.ui.internal.properties.StringComboBoxCellEditor This class comes from WTP project; It's an extended ComboBoxCellEditor that selects and returns Strings.
codemirror.eclipse.ui.xquery.viewers.StringComboBoxCellEditor It's the copy/paste of WTP StringComboBoxCellEditor; it adds the capability to add the item in the combo when it is not found.
How can I reference a position within a Set? Like with an array: array[5];
I am developing an android soundboard that has a favorites tab. The favorites tab uses a listview . When a user adds a favorite, the text of the button is added to the set. Now I have setup a contextmenu for the list view to allow the user to delete an item by long pressing, and pushing delete. The context menu passes the position of the list view that triggered the context menu and I am trying to delete that position.
You cannot. Sets have no notion of order, but concrete implementations may.
However, all sets implement toArray(), and
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
What's your underlying data structure?
You can't - a Set does not have indexes for its elements. You have two options, depending on your requirements:
use a SetUniqueList from commons-collections, if you want the properties of Set in a List
use Iterator (and a foreach loop) if you want to iterate the Set