本文整理汇总了Java中com.amap.api.services.poisearch.PoiResult类的典型用法代码示例。如果您正苦于以下问题:Java PoiResult类的具体用法?Java PoiResult怎么用?Java PoiResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PoiResult类属于com.amap.api.services.poisearch包,在下文中一共展示了PoiResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
//Toast.makeText(MainActivity.this,"+"+poiResult.getPois().toString()+poiResult.getPageCount(), Toast.LENGTH_SHORT).show();
if(poiResult.getPageCount()!=0){
isGetPOI =true;
if(marker==null){
marker= aMap.addMarker(new MarkerOptions().position(POILatlng).title(poiResult.getPois().toString().substring(1,poiResult.getPois().toString().length()-1)));
}
if( marker.getPosition()!=POILatlng) {
marker.remove();
marker= aMap.addMarker(new MarkerOptions().position(POILatlng).title(poiResult.getPois().toString().substring(1,poiResult.getPois().toString().length()-1)));
}
}else {
isGetPOI =false;
}
if(!isGetPOI){
if(top_view.getVisibility() == View.VISIBLE) top_view.setVisibility(View.INVISIBLE); else top_view.setVisibility(View.VISIBLE);
}else {
top_view.setVisibility(View.VISIBLE);
}
}
示例3: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
list = poiResult.getPois();
if(adapter==null){
adapter= new MyAdapter(list);
mlist.setAdapter(adapter);
}else{
adapter.setList(list);
}
// Log.i("xxxxxxxxxx", list.toString());
// mlist.setAdapter(new MyAdapter(list));
}
示例4: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int code) {
if (result != null && result.getPois().size() > 0) {
ArrayList<PoiItem> list = result.getPois();
for (int i = 0; i < list.size(); i++) {
String storeName = list.get(i).getTitle();
String addressName = list.get(i).getCityName()
+ list.get(i).getAdName() + list.get(i).getSnippet();
LatLonPoint point = list.get(i).getLatLonPoint();
PoiAddressSave poi = new PoiAddressSave(storeName, addressName,
point);
poiAddressList.add(poi);
}
if (poiAddressList != null && poiAddressList.size() > 0) {
CommonAdapter<PoiAddressSave> adapter = getPresenter().initAdapter(getActivity(),
poiAddressList, R.layout.listitem_fragmentmap);
getPresenter().adapterListView(listView, adapter);
}
}
}
示例5: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int resultCode) {
if (resultCode == 0 && poiResult != null) {
ArrayList<PoiItem> pois=poiResult.getPois();
if(pois==null){
return;
}
List<PositionEntity>entities=new ArrayList<PositionEntity>();
for(PoiItem poiItem:pois){
PositionEntity entity=new PositionEntity(poiItem.getLatLonPoint().getLatitude(),
poiItem.getLatLonPoint().getLongitude(),poiItem.getTitle()
,poiItem.getCityName());
entities.add(entity);
}
mRecommandAdapter.setPositionEntities(entities);
mRecommandAdapter.notifyDataSetChanged();
}
//TODO 可以根据app自身需求对查询错误情况进行相应的提示或者逻辑处理
}
示例6: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult arg0, int arg1) {
if (arg1 == 0) {
aMap.clear();// 清理之前的图标
List<PoiItem> poiItems = arg0.getPois();
if (poiItems.isEmpty()) {
Toast.makeText(getActivity(), "无查询结果!", Toast.LENGTH_SHORT)
.show();
} else {
for (PoiItem p : poiItems) {
Log.e("result", p.toString());
}
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
}
}
}
示例7: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
/**
* 搜索成功后回调函数
*/
@Override
public void onPoiSearched(PoiResult arg0, int arg1) {
// TODO Auto-generated method stub
if (arg1 == 0) {
aMap.clear();// 清理之前的图标
Log.e("result", "success");
List<PoiItem> poiItems = arg0.getPois();
if (poiItems.isEmpty()) {
Toast.makeText(getApplicationContext(), "无查询结果!",
Toast.LENGTH_SHORT).show();
} else {
for (PoiItem p : poiItems) {
Log.e("result", p.toString());
}
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
}
}
}
示例8: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int rCode) {
dissmissProgressDialog();
System.out.println("搜索结果页数:"+poiResult.getPageCount());
if (rCode == 0) {
this.poiResult = poiResult;
pois = poiResult.getPois();
adapter.setList(pois);
listView.smoothScrollToPosition(0);
footView.setVisibility(View.VISIBLE);
adapter.notifyDataSetChanged();
} else if (rCode == 27) {
footView.setVisibility(View.GONE);
// 搜索失败,请检查网络连
} else if (rCode == 32) {
footView.setVisibility(View.GONE);
// key验证无效
} else {
footView.setVisibility(View.GONE);
// 未知错误,请稍后重试!错误码为 rCode
}
}
示例9: 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);
}
}
示例10: 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开始
}
}
}
}
示例11: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
Log.d(TAG, "onPoiSearched: result code is "+i);
if (i == 1000){
List<PoiItem> poiItemList = poiResult.getPois();
Log.d(TAG, "onPoiSearched: first poi is "+poiItemList.get(0).getTitle());
mapActivity.poiItemList = poiItemList;
poiActAdapter = new PoiActAdapter(poiItemList,mapActivity.pointType,mapActivity.mContext);
mapActivity.poiListLV.setAdapter(poiActAdapter);
}else {
Log.d(TAG, "onPoiSearched: error ");
}
}
示例12: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
ArrayList<PoiItem> poiItems = new ArrayList<>();
if (mLocation != null) {
PoiItem location = new PoiItem("location", new LatLonPoint(mLocation.getLatitude(), mLocation.getLongitude()), mLocation.getPoiName(), mLocation.getAddress());
poiItems.add(location);
}
if (poiResult != null && poiResult.getPois().size() > 0) {
poiItems.addAll(poiResult.getPois());
}
mAdapter.setItems(poiItems);
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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();
}
}