Java Examples for com.baidu.mapapi.map.MKEvent
The following java examples will help you to understand the usage of com.baidu.mapapi.map.MKEvent. These source code samples are taken from different open source projects.
Example 1
| Project: gyz-master File: BMapApiApp.java View source code |
@Override
public void onGetPermissionState(int iError) {
Log.d("MyGeneralListener", "onGetPermissionState error is " + iError);
if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
// ��ȨKey����
Toast.makeText(BMapApiApp.mDemoApp.getApplicationContext(), "baidu key error", Toast.LENGTH_LONG).show();
BMapApiApp.mDemoApp.m_bKeyRight = false;
}
}Example 2
| Project: YikuairAndroid-master File: LocationEngine.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Log.e("yikuair", "BaiduLocation says network error" + "error number is: " + iError);
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Log.e("yikuair", "BaiduLocation says network data error" + "error number is: " + iError);
}
// ...
}Example 3
| Project: ChangYou-master File: MyRenren.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Toast.makeText(MyRenren.getInstance().getApplicationContext(), "您的网络出错啦!", Toast.LENGTH_LONG).show();
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Toast.makeText(MyRenren.getInstance().getApplicationContext(), "输入正确的检索条件!", Toast.LENGTH_LONG).show();
}
// ...
}Example 4
| Project: My_Android_fzbmzxc-master File: Location.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Toast.makeText(Location.getInstance().getApplicationContext(), "您的网络出错啦!", Toast.LENGTH_LONG).show();
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Toast.makeText(Location.getInstance().getApplicationContext(), "输入正确的检索条件!", Toast.LENGTH_LONG).show();
}
// ...
}Example 5
| Project: com.mzeat-master File: ShoppingDetailActivity.java View source code |
@Override
public void onGetPermissionState(int iError) {
// TODO Auto-generated method stub
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Log.e("iError", String.valueOf(iError));
Toast.makeText(MzeatApplication.getInstance().getApplicationContext(), "您的网络出错啦!", Toast.LENGTH_LONG).show();
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Toast.makeText(MzeatApplication.getInstance().getApplicationContext(), "输入正确的检索条件!", Toast.LENGTH_LONG).show();
}
}Example 6
| Project: searchhealth-master File: BDrugStoreRoute.java View source code |
public void onGetDrivingRouteResult(MKDrivingRouteResult res, int error) {
async_begin.setVisibility(View.GONE);
// �����յ������壬��Ҫѡ�����ij����б���ַ�б�
if (error == MKEvent.ERROR_ROUTE_ADDR) {
// res.getAddrResult().mEndCityList;
return;
}
// ����ſɲο�MKEvent�еĶ���
if (error != 0 || res == null) {
Toast.makeText(BDrugStoreRoute.this, "��Ǹ��δ�ҵ����", Toast.LENGTH_SHORT).show();
return;
}
searchType = 0;
if (routeOverlay == null) {
routeOverlay = new RouteOverlay(BDrugStoreRoute.this, mMapView);
// ���·��ͼ��
mMapView.getOverlays().add(routeOverlay);
}
// �˴���չʾһ��������Ϊʾ��
routeOverlay.setData(res.getPlan(0).getRoute(0));
// ִ��ˢ��ʹ��Ч
mMapView.refresh();
/*// ʹ��zoomToSpan()���ŵ�ͼ��ʹ·������ȫ��ʾ�ڵ�ͼ��
mMapView.getController().zoomToSpan(routeOverlay.getLatSpanE6(),
routeOverlay.getLonSpanE6());*/
// �ƶ���ͼ�����
mMapView.getController().animateTo(res.getStart().pt);
// ��·�����ݱ����ȫ�ֱ���
route = res.getPlan(0).getRoute(0);
// ����·�߽ڵ��������ڵ����ʱʹ��
nodeIndex = -1;
mBtnPre.setVisibility(View.VISIBLE);
mBtnNext.setVisibility(View.VISIBLE);
isRouted = true;
}Example 7
| Project: like_googleplus_layout-master File: LocationActivity.java View source code |
@Override
public void onGetDrivingRouteResult(MKDrivingRouteResult res, int error) {
// 起点或终点有歧义,需要选择具体的城市列表或地址列表
if (error == MKEvent.ERROR_ROUTE_ADDR) {
return;
}
// 错误号可参考MKEvent中的定义
if (error != 0 || res == null) {
Toast.makeText(LocationActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
return;
}
// 将路线数据保存给全局变量
mDividerRoute = res.getPlan(0).getRoute(0);
getRouteInfo(res);
mRouteOverlay = new RouteOverlay(LocationActivity.this, mMapView);
if (mSelfRoute) {
mDividerRoute.customizeRoute(mStartGeoPoint, mEndGeoPoint, dummyData());
}
// 此处仅展示一个方案作为示例
mRouteOverlay.setData(mDividerRoute);
// 清除其他图层
// mMapView.getOverlays().clear();
// 添加定位地点图层
// mMapView.getOverlays().add(mLocationOverlay);
// 添加路线图层
mMapView.getOverlays().add(mRouteOverlay);
// 执行刷新使生效
mMapView.refresh();
// 使用zoomToSpan()绽放地图,使路线能完全显示在地图上
mMapView.getController().zoomToSpan(mRouteOverlay.getLatSpanE6(), mRouteOverlay.getLonSpanE6());
// 移动地图到起点
mMapView.getController().animateTo(res.getStart().pt);
// 重置路线节点索引,节点浏览时使用
}Example 8
| Project: pub_Android-master File: CommonApplication.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
// Toast.makeText(CommonApplication.getInstance(), "您的网络出错啦!",
// Toast.LENGTH_SHORT).show();
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
// Toast.makeText(CommonApplication.getInstance(), "输入正确的检索条件!",
// Toast.LENGTH_SHORT).show();
}
}Example 9
| Project: Wawc-master File: SearchMapActivity.java View source code |
@Override
public void onGetPoiResult(MKPoiResult res, int type, int error) {
Log.d(TAG, "onGetPoiResult: error = " + error + " , " + "type = " + type);
if (error == MKEvent.ERROR_RESULT_NOT_FOUND) {
Toast.makeText(SearchMapActivity.this, R.string.search_result_not_found, Toast.LENGTH_SHORT).show();
return;
} else if (error != 0 || res == null) {
Toast.makeText(SearchMapActivity.this, R.string.search_error, Toast.LENGTH_SHORT).show();
return;
}
// 用户判断是否已经收藏
String str = "";
for (MKPoiInfo mkPoiInfo : res.getAllPoi()) {
int distance = (int) DistanceUtil.getDistance(point, mkPoiInfo.pt);
AdressData adressData = new AdressData();
adressData.setName(mkPoiInfo.name);
adressData.setAdress(mkPoiInfo.address);
adressData.setPhone(mkPoiInfo.phoneNum);
adressData.setLat(mkPoiInfo.pt.getLatitudeE6() / 1e6);
adressData.setLon(mkPoiInfo.pt.getLongitudeE6() / 1e6);
adressData.setDistance(distance);
adressDatas.add(adressData);
str = str + mkPoiInfo.name + ",";
}
Log.d(TAG, "str = " + str);
// 排序
Collections.sort(adressDatas, new Comparator());
adressAdapter.notifyDataSetChanged();
for (int i = 0; i < adressDatas.size(); i++) {
GeoPoint point1 = new GeoPoint((int) (adressDatas.get(i).getLat() * 1E6), (int) (adressDatas.get(i).getLon() * 1E6));
OverlayItem item = new OverlayItem(point1, "item2", "item2");
overlayCar.addItem(item);
}
mMapView.refresh();
// 判断是否收藏
String url;
try {
url = Constant.BaseUrl + "favorite/is_collect?auth_code=" + Variable.auth_code + "&names=" + URLEncoder.encode(str, "UTF-8") + "&cust_id=" + Variable.cust_id;
new Thread(new NetThread.GetDataThread(handler, url, getIsCollect)).start();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}Example 10
| Project: TripGuide_XiDian-master File: MapBase.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Log.i("axlecho", "您的网络出错啦!");
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Log.i("axlecho", "输入正确的检索条件!");
}
}Example 11
| Project: zaina-master File: BaiduMapActivity.java View source code |
@Override
public void onGetNetworkState(int iError) {
if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
Toast.makeText(BaiduMapActivity.this, "您的网络出错啦!", Toast.LENGTH_LONG).show();
} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
Toast.makeText(BaiduMapActivity.this, "输入正确的检索条件!", Toast.LENGTH_LONG).show();
}
// ...
}