How can I search an Android ListView using hidden keywords? - android-listview

I have a ListView with a list of rooms.
Some of the rooms in the list are Students' Activity Center, Classroom 101, and Classroom 102.
I also have an EditText which allows the user to search a room in the list.
However, I also want to add additional keywords which would not appear on the list but are searchable. For example, if the user searches for "SAC", the Students' Activity Center will be shown in the ListView.
Right now, the user could only search what is visible in the ListView.

You can use 2 override methods setTag(Object tag) and setTag (int key, Object tag) methods. Link at View setTag. Afterwards you call getTag to get the keywords, as you put it. Sample code:
String itemName = (String) myButton.getTag();
The idea of using tags is not new and has been used in various different libraries and frameworks.

Related

Drools Business Central Workbench - Test Scenario: List subproperty on object

Is there a way to populate a List property on an object being tested under the "new style" test scenario?
I see some "legacy" test cases which seem to achieve this so am wondering if the new style test scenario handles this.
I added the List model to my test case, which enabled me to expand the sub-property on the object, however there is only one field available there, "empty" (boolean). Is there a way to add an object here? If it makes any difference, the model is an external java dependency.
Update
The reason I wasn't able to add the List of objects was because I didn't explicitly import that object dependency into the test. Once you import it you can follow the steps given in the answer below.
It's definitely possible to manage a List property under the Test Scenario Editor.
Please consider the following example: A Book class with a List<String> property named topics.
Creating a new Test Scenario assets, please select the column where you need to add the List property, and in the right part of the editor select the property expanding the Book class, as shown below:
Pressing Insert Data Ojbect button will assign the selected List property to the selected column:
To fill the data in the List property, please double click on the Insert value cell, in the first scenario data row. A popup will appear. Its aim is to fill data inside a collection
To add a value, please press the Add list value link in the bottom part of the popup. Here, you'll be able to fill a single item on the list
Repeat this step for all the items you need to add to the list. When completed, simply press to Save button
The popup will close and you should see the previously selected data cell filled with a label similar to List(2), the number represents the number of the items in the list.

Android Display a random Item from List without showing the ListView

I am practicing on this project called GetTours i got from github, now
I want to display random Item from the ListView without seeing the ListView. not only show random item from ListView, but also print the details of the items, the item contains Name, address and lat long value for the map marker.
is that even possible?
or maybe, Teach me how to create a list that contains a name, address and lat long value and how to display it. I am also planning of randomizing it every time i shake the device. I had an app that do shake an random with a single data array, now I want to randomize a place with Name, address and a Map marker in the said location per shake. please help!
A ListView is not needed here, save your items in a List :
ArrayList<Item> items = new ArrayList<Item>;
items.add(item1);
items.add(item2);
//...
Then select a random number with the maximum as the length of your list :
final int random = Random.nextInt(items.size());
And then, do what you need to do with the data :
Item randomItem = items.get(random);
nameTextView.setText(randomItem.getName());
priceTextView.setText("" + randomItem.getPrice());
//...

MvvmCross DataBinding To Modify Individual Item in Android ListView

I am trying to dynamically modify the items in a List (ObservableCollection) of a ViewModel and have those changes get updated in the View via MvvmCross bindings. My eventual goal is that when a user clicks on a list item, I will pop up a dialog asking them to edit that item. When the dialog is dimissed, the viewmodel will get updated (through an ICommand I assume) and that modified value will be now be in the list.
I haven't looked into dialogs yet, so for now I am just trying to toggle a boolean value each time a list item is clicked and have that value changed in the MvxListView. I have the MxvListView in my View bound to an ObservableCollection in my ViewModel and have an MvxCommand that is getting called when an item is selected. All this is working and I can see the value getting changed in the debugger, however, the new values are not being displayed in the MvxListView. So my question is: How do I get modified data in individual items in an ObservableCollection to bind to an MvxListView?
All of the examples I have seen online use ObservableCollection for dynamic binding but they only ever Add or Delete items. I haven't found any examples of modifying the items. If I change the code in my MvxCommand from modifying the data to adding or deleting an item, the list will get updated. So that tells me I'm close I think.
Rather than copy paste the code in here, I created a sample project on github here to look at:
https://github.com/smulrich/breaktimer
I appreciate the help.
You can simply replace
Breaks[index] = b;
with
Breaks[index] = new DailyBreak() { Reason = b.Reason, TimeOfDay = b.TimeOfDay, Enabled = b.Enabled };
or more reasonable, you should realize INotifyPropertyChanged for class DailyBreak
Diffrent among List, ObservationCollection and INotifyPropertyChanged, please refer to enter link description here

How can i achieve this smart search in obj c

In my iphone app i have a search screen with UISearchDisplaycontroller uisng this against each scopeBar key words we can filter the search result, But using only this scopeBar buttons i couldnt reach my requirement.
See, I have a list of members, I need to search members based on state, country, city, name. and i should display these search types in a bar (say scopBar).
After selecting a scopeBar button(say Country)if we type 'India' in the search bar it should display all the members of that country. How can i achieve these kind of search ? I have tried many search tutorials, But those didnt help me. Please help me out.
Thanks in Advanced!
As per Apple's Sample code, we can use 2 arrays during search, 1 actual, and 2nd is filtered array as in example reference :
http://developer.apple.com/library/ios/#samplecode/TableSearch/Listings/MainViewController_m.html#//apple_ref/doc/uid/DTS40007848-MainViewController_m-DontLinkElementID_6
But in your case, we are requiring 3 arrays, third array will be local array (let's call scopedFilteredArray) during filteration.
Search all objects by scope bar : Using Predicate (contained by scopedFilteredArray, from actual array).
Search filtered objects from scopedFilteredArray and save them in filteredArray for display.
Have a modal window appear to select your extra filter parameters (put whatever control you want there), and create a global search nsmutabledictionary to store your parameters.
I put it to appear on the book (bookmarks) button (it passed apple checks), for easy access.

How to make a editor just output part of datas(eclipse plugin development)

I have some structured item want to show by editor, for example, the item's structure may like this {1,"hello"}, the "1" identity this item and the "hello" is item's content. now i want just show item's content to user, but the editor should know the item's identity, then, when one user select the content of an item, the editor should pass the item's identity to me, so i could know which item the user selected clearly(because the identity's function is just to distinguish items, so it should not be output to disturb users).
Any sugesstion is appreciated!
You can base your editor on a JFace viewer, where the viewers input (set by the setInput() method) is the collection of items you presented.
The content provider traverses this collection, and returns the correct items; finally the labelprovider returns only the content of the item.