我有一个要搜索的活动。当我点击搜索时,OnNewIntent
它被调用了两次......我做错了什么?
我正在像这样创建 Searchview
public override bool OnCreateOptionsMenu(IMenu menu)
{
searchView = new SearchView(this);
var searchManager = (SearchManager)GetSystemService(Context.SearchService);
var searchableInfo = searchManager.GetSearchableInfo(ComponentName);
searchView.SetSearchableInfo(searchableInfo);
var search_item = menu.Add(new Java.Lang.String("Search"));
search_item.SetActionView(searchView);
search_item.SetShowAsAction(ShowAsAction.IfRoom);
var edit = menu.Add(0, insertItemID, 0, "Insert");
edit.SetShowAsAction(ShowAsAction.IfRoom);
edit.SetIcon(Android.Resource.Drawable.IcMenuAdd);
return base.OnCreateOptionsMenu(menu);
}
日志:
10-17 07:45:45.491 I/ActivityManager( 900): START {act=android.intent.action.SEARCH flg=0x10000000 cmp=Intranet.Intranet/intranet.screens.ContactListActivity (has extras)} from pid 2971
10-17 07:45:47.562 W/EGL_emulation( 2971): eglSurfaceAttrib not implemented
10-17 07:45:47.562 I/ActivityManager( 900): START {act=android.intent.action.SEARCH flg=0x10000000 cmp=Intranet.Intranet/intranet.screens.ContactListActivity (has extras)} from pid 2971
10-17 07:45:48.472 D/OpenGLRenderer( 2971): Flushing caches (mode 0)
10-17 07:45:48.481 D/dalvikvm( 900): GC_CONCURRENT freed 559K, 13% free 7991K/9159K, paused 1ms+1ms
10-17 07:45:48.500 W/InputManagerService( 900): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b48b3470
10-17 07:45:48.561 D/dalvikvm( 963): GC_CONCURRENT freed 389K, 41% free 6027K/10183K, paused 0ms+0ms