当前位置: 首页>>代码示例>>Java>>正文


Java PoiResult类代码示例

本文整理汇总了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));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:PoiAroundSearchActivity.java

示例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);
    }
}
 
开发者ID:BoldFei,项目名称:Zmap_test,代码行数:23,代码来源:MainActivity.java

示例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));
}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:18,代码来源:LocationActivity.java

示例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);
		}
	}
}
 
开发者ID:wangcantian,项目名称:Mobile-Office,代码行数:21,代码来源:MapFragment.java

示例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自身需求对查询错误情况进行相应的提示或者逻辑处理
}
 
开发者ID:amapapi,项目名称:Android_UsingCar_Example,代码行数:20,代码来源:PoiSearchTask.java

示例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();
		}
	}
}
 
开发者ID:Extrace,项目名称:Extrace_UserApp,代码行数:20,代码来源:TransNodeTabFragment.java

示例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();
		}
	}

}
 
开发者ID:Extrace,项目名称:Extrace_UserApp,代码行数:26,代码来源:MultyLocationActivity.java

示例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
    }
}
 
开发者ID:treejames,项目名称:Map4amap,代码行数:23,代码来源:NearFragment.java

示例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);
    }
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:43,代码来源:PiclocationActivity.java

示例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开始
                }
            }
        }
    }
 
开发者ID:larrySmile02,项目名称:MultipleViewMap,代码行数:12,代码来源:PoiSearchTask.java

示例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 ");
    }
}
 
开发者ID:yimiaoxiehou,项目名称:ZhuHaiBusApplication,代码行数:14,代码来源:Poi.java

示例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);
}
 
开发者ID:bravecheng,项目名称:BingMapDemo,代码行数:13,代码来源:SampleActivity.java

示例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);
    }
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:40,代码来源:SearchCityActivity.java

示例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);
	}
}
 
开发者ID:Tsroad,项目名称:Road,代码行数:43,代码来源:PoiAroundSearchActivity.java

示例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();
        }
    }
 
开发者ID:treejames,项目名称:Map4amap,代码行数:34,代码来源:SearchLocationMap.java


注:本文中的com.amap.api.services.poisearch.PoiResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。