本文整理汇总了Java中com.amap.api.services.poisearch.PoiResult.getPois方法的典型用法代码示例。如果您正苦于以下问题:Java PoiResult.getPois方法的具体用法?Java PoiResult.getPois怎么用?Java PoiResult.getPois使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.services.poisearch.PoiResult
的用法示例。
在下文中一共展示了PoiResult.getPois方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: 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);
}
}
}
示例3: 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自身需求对查询错误情况进行相应的提示或者逻辑处理
}
示例4: 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();
}
}
}
示例5: 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();
}
}
}
示例6: 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
}
}
示例7: 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);
}
}
示例8: 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 ");
}
}
示例9: 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);
}
}
示例10: 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();
}
}
示例11: 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();
}
}
示例12: 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);
}
}
示例13: onPoiSearched
import com.amap.api.services.poisearch.PoiResult; //导入方法依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
if (0==i)//获取成功
{
List <PoiItem> list= poiResult.getPois();
for (int ii=0;ii<list.size();ii++)
{
PoiItem item= list.get(ii);
Log.e("------------->",item.toString());
}
}
// 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);
// }
}