Hi,
Here is some sample code that I use the SearchManager to show the
search UI in my activity. My issue is that the onDismiss() below is
not called.
protected void onCreate(Bundle savedInstanceState)
{
...
mSearchManager = (SearchManager) getSystemService
(Context.SEARCH_SERVICE);
mSearchManager.setOnDismissListener(new
SearchManager.OnDismissListener() {
public void onDismiss() {
// Do something
}
});
mSearchManager.setOnCancelListener(new
SearchManager.OnCancelListener() {
public void onCancel() {
// Do something
}
});
startSearch(null, false, null, true);
}
When the user enter a text in the search UI and start the search, my
onDismiss() method in the SearchManager.OnDismissListener is not
called.
Here is what I found in the SearchManager/SearchDialog/Dialog code
that may be the root cause of the issue.
1) SearchDialog:launchQuerySearch calls
2) Dialog:dismiss() calls
3) mDismissAction.run() (Thread.currentThread() should still be equal
to mUiThread in the if statement in the dismiss())
4) Dialog:dismissDialog() calls (note SearchDialog:onStop() is called
before Dialog:sendDismissMessage() in the dismissDialog() method)
5) SearchDialog:onStop() calls
6) Dialog:setOnDismissListener(null) which reset the mDismissMessage =
null So, by the time the Dialog:sendDismissMessage() is called in
Dialog:dismissDialog() on step 4, the Message.obtain
(mDismissMessage).sendToTarget() is not called since mDismissMessage
is null and my activity's onDismiss() is not called.
Probably the SearchDialog should have reset the listeners in its
onDestroy() instead of onStop().
Would you please verify if it is the root cause of the issue and if a
proper fix can be implemented?
Thanks,
Stephen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---