SearchDialog 无法在 ActivityGroup 内显示
我在 ActivityGroup 中有两项活动,一项是“ProvinceActivity”,另一项是“CityActivity”。 所以代码:
public class CityManagerActivity extends ActivityGroup {
View v1 = getLocalActivityManager().startActivity(
"tab1",
new Intent(this, ProvinceActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
replaceView(v1);
}
但是当我通过按“tab1”中的搜索键进行默认搜索时,搜索我遇到错误:
08-19 17:18:23.438: ERROR/AndroidRuntime(9078): Uncaught handler: thread main exiting due to uncaught exception
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): java.lang.IllegalArgumentException: no ident
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.ensureSearchManager(Activity.java:3499)
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.startSearch(Activity.java:2648)
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.onSearchRequested(Activity.java:2612) ...
第二个搜索有效,请告诉我该怎么做,请...
i have two activities within an ActivityGroup, one "ProvinceActivity" and another "CityActivity".
so code:
public class CityManagerActivity extends ActivityGroup {
View v1 = getLocalActivityManager().startActivity(
"tab1",
new Intent(this, ProvinceActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
replaceView(v1);
}
but when I have a default searchable by pressing search-key in the "tab1" the search i have the ERROR:
08-19 17:18:23.438: ERROR/AndroidRuntime(9078): Uncaught handler: thread main exiting due to uncaught exception
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): java.lang.IllegalArgumentException: no ident
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.ensureSearchManager(Activity.java:3499)
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.startSearch(Activity.java:2648)
08-19 17:18:23.458: ERROR/AndroidRuntime(9078): at android.app.Activity.onSearchRequested(Activity.java:2612) ...
the second search works,tell me how to do it,plz...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有同样的问题。我用这个并解决了问题。
Have same problem. I use this and it fix the problem.
对于其他人,我认为通过返回 true,应用程序会显示用户不期望的行为,因为它应该显示某种搜索,并且通过返回 true 这将被覆盖。
文章 http:// www.app-solut.com/blog/2011/10/unexpected-behavior-when-working-with-nested-tabhosts/ 展示了如何在 TabHost 中解决此问题而不更改默认行为的好方法。
For others i think by just returning true the app shows an behavior which the user does not expect because it should show some kind of search and by returning true this is overridden.
The article http://www.app-solut.com/blog/2011/10/unexpected-behavior-when-working-with-nested-tabhosts/ shows a good way how to solve this problem in a TabHost without changing the default behavior.