Google의 Searchable Dictionary 버전을 구현했으며 몇 가지 문제가 있습니다.Android MapView Search 구성 요소가 새로운 의도를 생성하지 않도록 유지
나는 검색하고자하는 기본 ItemizedOverlay가있는 MapView 액티비티에서 구현하고있다. 데이터를 ItemizedOverlay와 동일하게 바꾸 었으며 모든 것이 잘 쿼리 된 것 같습니다.
그러나 목록에서 검색 항목을 선택하면 검색 활동을 시작한 원래 의도가 이벤트를 처리하는 것으로 나타나고 새로운 MapView 의도가 생성되어 똑같은 작업을 수행합니다 (따라서 내가 "뒤로"버튼, 나는 중복 mapView로 돌아 간다.) 열 인덱스가 아닌 그것이 나에게 지점의 위도/경도를 제공합니다 (그래 내가 아는 -
가@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_map);
initializeComponents();
addOverlays();
Intent intent = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
// handles a click on a search suggestion; launches activity to show word
int lat, lon;
Uri uri = intent.getData();
Cursor c = getContentResolver().query(uri, null, null, null, null);
try {
c.moveToFirst();
lat = Integer.parseInt(c.getString(2));
lon = Integer.parseInt(c.getString(6));
} finally {
c.close();
}
//this is the ItemizedOverlay that holds the building icons
buildingIcons.onTap(new GeoPoint(lat, lon), mapView);
Toast.makeText(this, "you searched for " + lat + ", " + lon, Toast.LENGTH_LONG).show();
}
}
미친 것은 토스트 통지가 잘 작동된다
내지도보기 클래스는 다음과 같습니다 그것을 검색하는 가장 좋은 방법). 두 번째 MapView 인 텐트가 만들어진 이유에 대한 아이디어가 있습니까?
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:searchSettingsDescription="@string/settings_description"
android:searchSuggestAuthority=".map.DictionaryProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://.map.DictionaryProvider/dictionary"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1"
android:includeInGlobalSearch="true"
>
좋아