Search Results

Search found 8 results on 1 pages for 'searchview'.

Page 1/1 | 1 

  • SearchView - Choose between two target Activities according to the query result

    - by vitorgreati
    My application has to do the following: - if the user enters a query that matches exactly an object in my database, a Activity that shows this object should appear; - if the query doesn't match an exact object, a ArrayList with related objects will be returned and an Activity will display this list. So, as I'm using a SearchView on my ActionBar, I want to know how to open the right Activity based on the result of the query, something like this: if(objectFound) openActivityThatShowsThisObject(); else openActivityWithRelatedResults(); I saw in other question that I could use a facade Activity, but I don't know if that is a good approach. Any help will be appreciated, thanks!

    Read the article

  • Action bar with Search View. Reverse compatibility issues

    - by suresh
    I am building a sample app to demonstrate SearchView with filter and other Action Bar items. I am able to successfully run this app on 4.2(Nexus 7). But it is not running on 2.3. I googled about the issue. Came to know that i should use SherLock Action bar. I just went to http://actionbarsherlock.com/download.html, downloaded the zip file and added the library as informed in the video: http://www.youtube.com/watch?v=4GJ6yY1lNNY&feature=player_embedde by WiseManDesigns. But still I am unable to figure out the issue. Here is my code: SearchViewActionBar.java public class SearchViewActionBar extends Activity implements SearchView.OnQueryTextListener { private SearchView mSearchView; private TextView mStatusView; int mSortMode = -1; private ListView mListView; private ArrayAdapter<String> mAdapter; protected CharSequence[] _options = { "Wild Life", "River", "Hill Station", "Temple", "Bird Sanctuary", "Hill", "Amusement Park"}; protected boolean[] _selections = new boolean[ _options.length ]; private final String[] mStrings = Cheeses.sCheeseStrings; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); // mStatusView = (TextView) findViewById(R.id.status_text); // mSearchView = (SearchView) findViewById(R.id.search_view); mListView = (ListView) findViewById(R.id.list_view); mListView.setAdapter(mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings)); mListView.setTextFilterEnabled(true); //setupSearchView(); } private void setupSearchView() { mSearchView.setIconifiedByDefault(true); mSearchView.setOnQueryTextListener(this); mSearchView.setSubmitButtonEnabled(false); //mSearchView.setQueryHint(getString(R.string.cheese_hunt_hint)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.searchview_in_menu, menu); MenuItem searchItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) searchItem.getActionView(); //setupSearchView(searchItem); setupSearchView(); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { if (mSortMode != -1) { Drawable icon = menu.findItem(mSortMode).getIcon(); menu.findItem(R.id.action_sort).setIcon(icon); } return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { String c="Category"; String s=(String) item.getTitle(); if(s.equals(c)) { System.out.println("same"); showDialog( 0 ); } //System.out.println(s); Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show(); return true; } protected Dialog onCreateDialog( int id ) { return new AlertDialog.Builder( this ) .setTitle( "Category" ) .setMultiChoiceItems( _options, _selections, new DialogSelectionClickHandler() ) .setPositiveButton( "SAVE", new DialogButtonClickHandler() ) .create(); } public class DialogSelectionClickHandler implements DialogInterface.OnMultiChoiceClickListener { public void onClick( DialogInterface dialog, int clicked, boolean selected ) { Log.i( "ME", _options[ clicked ] + " selected: " + selected ); } } public class DialogButtonClickHandler implements DialogInterface.OnClickListener { public void onClick( DialogInterface dialog, int clicked ) { switch( clicked ) { case DialogInterface.BUTTON_POSITIVE: printSelectedPlanets(); break; } } } protected void printSelectedPlanets() { for( int i = 0; i < _options.length; i++ ){ Log.i( "ME", _options[ i ] + " selected: " + _selections[i] ); } } public void onSort(MenuItem item) { mSortMode = item.getItemId(); invalidateOptionsMenu(); } public boolean onQueryTextChange(String newText) { if (TextUtils.isEmpty(newText)) { mListView.clearTextFilter(); } else { mListView.setFilterText(newText.toString()); } return true; } public boolean onQueryTextSubmit(String query) { mStatusView.setText("Query = " + query + " : submitted"); return false; } public boolean onClose() { mStatusView.setText("Closed!"); return false; } protected boolean isAlwaysExpanded() { return false; } }

    Read the article

  • django-haystack urlpatterns include('haystack.urls') where does it lead to?

    - by Eugene
    I've recently begun to learn/install django/haystack/solr. Following the tutorial given in haystack site, I have urlpatterns = pattern('', r'^search/', include('haystack.urls')) I found haystack installed in /usr/local/lib/python2.6/dist-packages/haystack and located urls.py there. It has urlpatterns=patterns('haystack.views', url(r'^$', SearchView(), name='haystack_search'),) I thought the second argument of url() should be callable object. I looked at the views.py and SearchView is a class. What is going on here? What's get called eventually?

    Read the article

  • UISearchBarBackground Class

    - by Jim Bonner
    I am using the following piece of code to hide the background on a UISearchBar: [[searchView.subviews objectAtIndex:0] setHidden:YES]; Pretty simple, but I worry about hard coding a position in a subview list. So I went looking for the UISearchBarBackground.h file and cannot find it. Does any know where the definition is hiding?

    Read the article

  • Value of text box disapears - binding viewmodel to a tab (content control)

    - by Eli Perpinyal
    Based on the MVVM example by Josh Smith, I have implemented the multi tab option which binds to a different tab to a different view model using a simple datatemplate that binds a viewmodel to a view. <DataTemplate DataType="{x:Type fixtureVM:SearchViewModel}"> <SearchVw:SearchView/> </DataTemplate> The issue that I'm having, is when I switch tabs and then switch back again, the value in the textbox disappears. When I bind the Text in the textbox to a value in the ViewModel it does not disappear. This is fine, and I can overcome this but I am having another issue for example with the position of the scroll bar in a grid disappearing once the tab has lost focus. Why is the value disappearing? I'm assuming it is a WPF sub system task that cleans up resources!? how can I avoid this? I also feel it might be slowing down my app.

    Read the article

  • Backbone: rendering syntax

    - by ksol
    We're using Backbone.js in one of my team's projects, and this is the first time I use it. I've seen many times this kind of code (it's coffeescript, but clear enough I think. @ means this.) clients_view = new Homespa.Views.Orders.Clients.SectionView(collection: @options.clients) @$("#clients-section").html(clients_view.render().el) clients_search_view = new Homespa.Views.Orders.Clients.SearchView @$("#clients_search_modal").html(clients_search_view.render().el) Isn't there a better way to do this? I would expect to just call render on my view, and then everything's good, I shouldn't have to get the html and append/replace it by hand. Thanks for you time !

    Read the article

  • iPhone UIButton addTarget:action:forControlEvents: not working

    - by Aaron Vegh
    I see there are similar problems posted here, but none of the solutions work for me. Here goes: I have a UIButton instance inside a UIView frame, which is positioned within another UIView frame, which is positioned in the main window UIView. To wit: UIWindow --> UIView (searchView) --> UISearchBar (findField) --> UIView (prevButtonView) --> UIButton (prevButton) --> UIView (nextButtonView) --> UIButton (nextButton) So far, so good: everything is laid out as I want it. However, the buttons aren't accepting user input of any kind. I am using the UIButton method addTarget:action:forControlEvents: and to give you an idea of what I'm doing, here's my code for nextButton: nextButton = [UIButton buttonWithType:UIButtonTypeCustom]; [nextButton setImage:[UIImage imageNamed:@"find_next_on.png"] forState:UIControlStateNormal]; [nextButton setImage:[UIImage imageNamed:@"find_next_off.png"] forState:UIControlStateDisabled]; [nextButton setImage:[UIImage imageNamed:@"find_next_off.png"] forState:UIControlStateHighlighted]; [nextButton addTarget:self action:@selector(nextResult:) forControlEvents:UIControlEventTouchUpInside]; The method nextResult: never gets called, the state of the button doesn't change on touching, and there's not a damned thing I've been able to do to get it working. I assume that there's an issue with all these layers of views: maybe something is sitting on top of my button, but I'm not sure what it could be. In the interest of information overload, I found a bit of code that would print out all my view info. This is what I get for my entire view hierarchy: UIWindow {{0, 0}, {320, 480}} UILayoutContainerView {{0, 0}, {320, 480}} UINavigationTransitionView {{0, 0}, {320, 480}} UIViewControllerWrapperView {{0, 64}, {320, 416}} UIView {{0, 0}, {320, 416}} UIWebView {{0, 44}, {320, 416}} UIScroller {{0, 0}, {320, 416}} UIImageView {{0, 0}, {54, 54}} UIImageView {{0, 0}, {54, 54}} UIImageView {{0, 0}, {54, 54}} UIImageView {{0, 0}, {54, 54}} UIImageView {{-14.5, 14.5}, {30, 1}} UIImageView {{-14.5, 14.5}, {30, 1}} UIImageView {{0, 0}, {1, 30}} UIImageView {{0, 0}, {1, 30}} UIImageView {{0, 430}, {320, 30}} UIImageView {{0, 0}, {320, 30}} UIWebDocumentView {{0, 0}, {320, 21291}} UIView {{0, 0}, {320, 44}} UISearchBar {{10, 8}, {240, 30}} UISearchBarBackground {{0, 0}, {240, 30}} UISearchBarTextField {{5, -2}, {230, 31}} UITextFieldBorderView {{0, 0}, {230, 31}} UIPushButton {{205, 6}, {19, 19}} UIImageView {{10, 8}, {15, 15}} UILabel {{30, 7}, {163, 18}} UIView {{290, 15}, {23, 23}} UIButton {{0, 0}, {0, 0}} UIImageView {{-12, -12}, {23, 23}} UIView {{260, 15}, {23, 23}} UIButton {{0, 0}, {0, 0}} UIImageView {{-12, -12}, {23, 23}} UINavigationBar {{0, 20}, {320, 44}} UINavigationButton {{267, 7}, {48, 30}} UIImageView {{0, 0}, {48, 30}} UIButtonLabel {{11, 7}, {26, 15}} UINavigationItemView {{79, 8}, {180, 27}} UINavigationItemButtonView {{5, 7}, {66, 30}} MBProgressHUD {{0, 0}, {320, 480}} UIActivityIndicatorView {{141, 206}, {37, 37}} UILabel {{117, 247}, {86, 27}} The relevant part is noted above the UINavigationBar section. Anyone have any suggestions? I'm all out. Thanks for reading. Aaron.

    Read the article

1