• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Variable layout - am I doing this the best way?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an Activity whose layout has an EditText and search Button along the top, with the search results in a ListView underneath. All pretty simple so far. However, the search may not always produce a full result set and I want to give the user feedback when this occurs, along with options on how to proceed, if at all, with a potentially expensive operation. Those options and the appropriate status display will vary depending on the last action performed and the results it returned. I have decided to put the feedback/options in a small horizontal area between the search controls and the results list and to this end I have created a whole bunch of <ViewStub.../> elements in the main layout .xml file, one for each variation of feedback/options layout. Then in code I display only the appropriate version using .setVisibility(View.VISIBLE) and .setVisibility(View.GONE). This works but seems just a bit clumsy to me. Has anybody got a better solution? Any tricks or pitfalls I am missing?
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean full resultSet?

I do know that while searching when I was doing a search/ListActivity in my app, most of the tutorials had in the Adapter a way to display a row that said no results when the query returned zero results. Also they ran the search/query in AsyncTask so the search was Asynchronous they would have a progress dialog show up with a simple message. Then remove it when the query was done and fill in the ListActivity with the results.

Is this what you are hoping for?

Mark
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic