Android调用百度api 获取经纬度以及地图 demo
在使用百度api获取当前经纬度的时候,使用api demo,代码一模一样,可就是报错BMapManager这玩意没法实例化,坑我呀
demo上是这么写的:
package com.stgmobile.cyt.activity.enterprise;
import android.app.Application;
import android.util.Log;
import android.widget.Toast;
import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.MKEvent;
import com.baidu.mapapi.MKGeneralListener;
public class BMapApp extends Application {
static BMapApp mDemoApp;
//百度MapAPI的管理类
BMapManager mBMapMan = null;
// 授权Key
// 申请地址:http://developer.baidu.com/map/android-mobile-apply-key.htm
String mStrKey = "E411350F624D8D13522D964224B5B960950BE7B2";
boolean m_bKeyRight = true;// 授权Key正确,验证通过
// 常用事件监听,用来处理通常的网络错误,授权验证错误等
static class MyGeneralListener implements MKGeneralListener {
public void onGetNetworkState(int iError) {
Log.d("MyGeneralListener", "onGetNetworkState error is "+ iError);
Toast.makeText(BMapApp.mDemoApp.getApplicationContext(), "您的网络出错啦!",
Toast.LENGTH_LONG).show();
}
阅读(847) | 评论(0) | 转发(0) |