2011-01-17 3 views
0

안녕 모두,SearchManager를 로컬 앱에서 사용하는 방법은 무엇입니까?

나는 목록보기가있는 활동이 있습니다. 사람들의 의견에 따라 목록 뷰를 수정해야합니다.

나는 http://developer.android.com/guide/topics/search/search-dialog.html이라는 주제를 따라 구현하려고 시도했다. 그러나 문제는 검색 버튼을 누른 후 시스템에서 기본 검색 창 (대화 상대 또는 브라우저의 단어를 검색 할 수 있음) 만 얻을 수 있다는 것입니다.

내 질문은 로컬에서 검색을 구현하는 방법입니다.

미리 감사드립니다. 매니페스트

@Override 
public boolean onSearchRequested(){ 
    Bundle bundle=new Bundle(); 
    bundle.putString("data", "data"); 
    startSearch(null, false, bundle, false); 
    return true; 
} 

:

<searchable xmlns:android="http://schemas.android.com/apk/res/android" 
android:label="DiseaseListActivity" 
android:hint="Search Diseases..." 
android:searchMode="showSearchLabelAsBadge" 
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" 
android:voiceLanguageModel="free_form" 
android:voicePromptText="Please Speak" 

/>

searchable.xml :

<searchable xmlns:android="http://schemas.android.com/apk/res/android" 
android:label="DiseaseListActivity" 
android:hint="Search Diseases..." 
android:searchMode="showSearchLabelAsBadge" 
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" 
android:voiceLanguageModel="free_form" 
android:voicePromptText="Please Speak"/> 
검색 가능한 액티비티 ListActivity에서

답변

1

문제, searchable.xml, 우리는 대신에, 우리는

android:label="@string/app_name" 

여러분 모두 감사처럼 참조를 사용한다, 정적 문자열을 사용할 수 없습니다 해결했다.

크리스