posted 12 years ago
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?