本文整理汇总了Java中com.amap.api.services.poisearch.PoiResult.getQuery方法的典型用法代码示例。如果您正苦于以下问题:Java PoiResult.getQuery方法的具体用法?Java PoiResult.getQuery怎么用?Java PoiResult.getQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.services.poisearch.PoiResult
的用法示例。
在下文中一共展示了PoiResult.getQuery方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rcode) {
if (rcode == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
scroll();
} else if (suggestionCities != null && suggestionCities.size() > 0) {
doSearchQuery(mSearchText.getText().toString().trim(), suggestionCities.get(0).getCityCode(), true);
} else {
ToastUtils.showToast(PoiAroundSearchActivity.this,
getString(R.string.no_result));
}
}
} else {
ToastUtils.showToast(PoiAroundSearchActivity.this, getString(R.string.no_result));
}
} else {
ToastUtils.showToast(this.getApplicationContext(), String.valueOf(rcode));
}
}
示例2: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
/**
* 返回POI搜索异步处理的结果。
* @param result
* @param rcode
*/
@Override
public void onPoiSearched(PoiResult result, int rcode) {
if (rcode == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
// 取得搜索到的poiitems有多少页
List<PoiItem> poiItems = result.getPois();// 取得第一页的poiitem数据,页数从数字0开始
if (poiItems != null && poiItems.size() > 0) {
for (int i = 0;i<poiItems.size();i++){
PoiItem poiitem = poiItems.get(i);
ListViewHoldier holder = new ListViewHoldier();
holder.address = poiitem.getSnippet();
holder.title = poiitem.getTitle();
holder.lp = poiitem.getLatLonPoint();
if(data.size()>i+1){
data.remove(i+1);
}
data.add(i+1,holder);
}
mAdapter.notifyDataSetChanged();
mRecyclerView.setVisibility(View.VISIBLE);
progressDialogView.setVisibility(View.GONE);
} else {
progressbar.setVisibility(View.GONE);
tvHint.setText(R.string.no_location);
}
}
} else {
progressbar.setVisibility(View.GONE);
tvHint.setText(R.string.no_location);
}
} else {
progressbar.setVisibility(View.GONE);
tvHint.setText(R.string.no_location);
}
}
示例3: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int rcode) {
if (rcode == AMapException.CODE_AMAP_SUCCESS) {
if (poiResult != null && poiResult.getQuery() != null) {// 搜索poi的结果
if (poiResult.getQuery().equals(query)) {// 是否是同一条
// poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
}
}
}
}
示例4: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rCode) {
// ProgressHUD.dismiss();
if (rCode == 0) {// 返回成功
if (mPage == 0) {
show_msg.refreshComplete();
} else {
show_msg.getMoreComplete();
}
if (result != null && result.getQuery() != null && result.getPois() != null && result.getPois().size() > 0) {// 搜索poi的结果
// 取得搜索到的poiitems有多少条
int resultPages = result.getPageCount();
searchKey = mSearch.getText().toString().trim();
PoiItem item = new PoiItem("", null, "自定义该地点", "是否直接添加到线路中?");
// PoiItem item1 = new PoiItem("", null, city, "");
if (mPage == 0) {
poiItems.clear();
poiItems.add(0, item);
if (TextUtils.isEmpty(searchKey)) {
// poiItems.add(1, item1);
}
}
// poiItems = result.getPois();
// 取得poiitem数据
poiItems.addAll(result.getPois());
poiNameAdapter.notifyDataSetChanged();
} else {
// ProgressHUD.dismiss();
// AppUtility.showToast(getString(R.string.no_result));
}
} else if (rCode == 27) {
AppUtility.showToast(getString(R.string.error_network));
} else if (rCode == 32) {
// AppUtility.showToast(getString(R.string.error_key));
} else {
// AppUtility.showToast(getString(R.string.error_other) + rCode);
}
}
示例5: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
/**
* POI搜索回调方法
*/
@Override
public void onPoiSearched(PoiResult result, int rCode) {
dissmissProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
aMap.clear();// 清理之前的图标
poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
nextButton.setClickable(true);// 设置下一页可点
} else if (suggestionCities != null
&& suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
ToastUtil.show(PoiAroundSearchActivity.this,
R.string.no_result);
}
}
} else {
ToastUtil
.show(PoiAroundSearchActivity.this, R.string.no_result);
}
} else if (rCode == 27) {
ToastUtil
.show(PoiAroundSearchActivity.this, R.string.error_network);
} else if (rCode == 32) {
ToastUtil.show(PoiAroundSearchActivity.this, R.string.error_key);
} else {
ToastUtil.show(PoiAroundSearchActivity.this,getString(R.string.error_other) + rCode);
}
}
示例6: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rCode) {
disProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
// 取得搜索到的poiitems有多少页
List<PoiItem> poiItems = result.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = result.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
// aMap.clear();// 清理之前的图标
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
} else if (suggestionCities != null && suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
Toast.makeText(getApplication(), "没有搜索结果", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(getApplication(), "没有搜索结果", Toast.LENGTH_SHORT).show();
}
} else if (rCode == 27) {
Toast.makeText(getApplication(), "网络连接错误", Toast.LENGTH_SHORT).show();
} else if (rCode == 32) {
Toast.makeText(getApplication(), "地图秘钥无效", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplication(), "未知错误", Toast.LENGTH_SHORT).show();
}
}
示例7: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rCode) {
dissmissProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
poiResult = result;
if (result.getQuery().equals(query)) {// 是否是同一条
// 取得搜索到的poiitems有多少页
List<PoiItem> poiItems = result.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = result.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
// aMap.clear();// 清理之前的图标
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
} else if (suggestionCities != null && suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
Toast.makeText(getApplication(), "没有搜索结果", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(getApplication(), "没有搜索结果", Toast.LENGTH_SHORT).show();
}
} else if (rCode == 27) {
Toast.makeText(getApplication(), "网络连接错误", Toast.LENGTH_SHORT).show();
} else if (rCode == 32) {
Toast.makeText(getApplication(), "地图秘钥无效", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplication(), "未知错误", Toast.LENGTH_SHORT).show();
}
}
示例8: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rCode) {
dissmissProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
// 取得搜索到的poiitems有多少页
List<PoiItem> poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
PoiOverlay poiOverlay = new PoiOverlay(aMap,
poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
} else if (suggestionCities != null
&& suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
// ToastUtil.showLong(getActivity(),
// R.string.no_result);
}
}
} else {
// ToastUtil.showLong(getActivity(), R.string.no_result);
}
} else {
// ToastUtil.showLong(getActivity(), R.string.error_network);
}
}
示例9: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rCode) {
// TODO Auto-generated method stub
ProgressHUD.dismiss();
if (rCode == 0) {// 返回成功
if (mPage == 0) {
show_msg.refreshComplete();
} else {
show_msg.getMoreComplete();
}
if (result != null && result.getQuery() != null && result.getPois() != null && result.getPois().size() > 0) {// 搜索poi的结果
// 取得搜索到的poiitems有多少条
int resultPages = result.getPageCount();
searchKey = mSearch.getText().toString().trim();
PoiItem item = new PoiItem("", null, "不显示位置", "");
PoiItem item1 = new PoiItem("", null, city, "");
if (mPage == 0) {
poiItems.clear();
poiItems.add(0, item);
if (TextUtils.isEmpty(searchKey)) {
poiItems.add(1, item1);
}
}
Log.e("TAG", "----城市1----->" + city + "---集合--->" + item1);
// poiItems = result.getPois();
// 取得poiitem数据
poiItems.addAll(result.getPois());
poiNameAdapter.notifyDataSetChanged();
} else {
ProgressHUD.dismiss();
AppUtility.showToast(getString(R.string.no_result));
}
} else if (rCode == 27) {
AppUtility.showToast(getString(R.string.error_network));
} else if (rCode == 32) {
AppUtility.showToast(getString(R.string.error_key));
} else {
AppUtility.showToast(getString(R.string.error_other) + rCode);
}
}
示例10: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int rcode) {
if (rcode == 1000) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
//清除POI信息显示
// whetherToShowDetailInfo(false);
//并还原点击marker样式
if (mlastMarker != null) {
resetlastmarker();
}
//清理之前搜索结果的marker
if (poiOverlay != null) {
poiOverlay.removeFromMap();
}
aMap.clear();
poiOverlay = new MyPoiOverlay(aMap, poiItems);
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
aMap.addMarker(new MarkerOptions()
// .anchor(0.5f, 0.5f)
.icon(BitmapDescriptorFactory
.fromBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.point4)))
.position(new LatLng(lp.getLatitude(), lp.getLongitude())));
aMap.addCircle(new CircleOptions()
.center(new LatLng(lp.getLatitude(),
lp.getLongitude())).radius(5000)
.strokeColor(Color.BLUE)
.fillColor(Color.argb(50, 1, 1, 1))
.strokeWidth(2));
// } else if (suggestionCities != null
// && suggestionCities.size() > 0) {
// showSuggestCity(suggestionCities);
} else {
Toast.makeText(FindMapAroundAty.this,
"No Result!", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(FindMapAroundAty.this,
"No Result!", Toast.LENGTH_SHORT).show();
}
}
}
示例11: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
/**
* POI信息查询回调方法
*/
@Override
public void onPoiSearched(PoiResult result, int rCode) {
dissmissProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
// 取得搜索到的poiitems有多少页
List<PoiItem> poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
aMap.clear();// 清理之前的图标
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
} else if (suggestionCities != null
&& suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
ToastUtil.show(PoiKeywordSearchActivity.this,
R.string.no_result);
}
}
} else {
ToastUtil.show(PoiKeywordSearchActivity.this,
R.string.no_result);
}
} else if (rCode == 27) {
ToastUtil.show(PoiKeywordSearchActivity.this,
R.string.error_network);
} else if (rCode == 32) {
ToastUtil.show(PoiKeywordSearchActivity.this, R.string.error_key);
} else {
ToastUtil.show(PoiKeywordSearchActivity.this, getString(R.string.error_other) + rCode);
}
}
示例12: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
/**
* POI搜索回调方法
*/
@Override
public void onPoiSearched(PoiResult result, int rCode) {
dismissProgressDialog();// 隐藏对话框
if (rCode == 0) {
if (result != null && result.getQuery() != null) {// 搜索poi的结果
if (result.getQuery().equals(query)) {// 是否是同一条
poiResult = result;
poiItems.clear();
poiItems.addAll(poiResult.getPois());// 取得第一页的poiitem数据,页数从数字0开始
List<SuggestionCity> suggestionCities = poiResult
.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
if (poiItems != null && poiItems.size() > 0) {
aMap.clear();// 清理之前的图标
poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
nextButton.setClickable(true);// 设置下一页可点
} else if (suggestionCities != null
&& suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
ToastUtil.show(PoiAroundSearchActivity.this,
R.string.no_result);
}
}
} else {
ToastUtil
.show(PoiAroundSearchActivity.this, R.string.no_result);
}
} else if (rCode == 27) {
ToastUtil
.show(PoiAroundSearchActivity.this, R.string.error_network);
} else if (rCode == 32) {
ToastUtil.show(PoiAroundSearchActivity.this, R.string.error_key);
} else {
ToastUtil.show(PoiAroundSearchActivity.this,
getString(R.string.error_other) + rCode);
}
}