整合高德地图时报错bundle为空

问题描述

整合高德地图时报错bundle为空

.xml

 <com.amap.api.maps2d.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_weight="1"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

java

public class AdressActivity extends Activity implements GeocodeSearch.OnGeocodeSearchListener {
    private static final String TAG="AdressActivity";
    final int FLIP_SPACE=100;

    private MapView mapView;
    private AMap aMap;

    private EditText editText;
    private Button button;

    private int radiu=80;//地图圆形区域半径
    private LatLonPoint point;//地址的经纬度对象
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mapView= (MapView) findViewById(R.id.map);
        editText= (EditText) findViewById(R.id.new_address_edit_text);
        button= (Button) findViewById(R.id.location);

        //必须回掉mapview的oncreat方法
        mapView.onCreate(savedInstanceState);
        mapView.onResume();
        init();

        //设置使用普通地图
        aMap.setMapType(AMap.MAP_TYPE_NORMAL);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(editText.equals("")){
                    Toast.makeText(AdressActivity.this,getResources().getString(R.string.location_edit_empty),Toast.LENGTH_LONG).show();
                }else{
                    GeocodeSearch geocodeSearch=new GeocodeSearch(AdressActivity.this);
                    geocodeSearch.setOnGeocodeSearchListener(AdressActivity.this);
                    GeocodeQuery query=new GeocodeQuery(editText.getText().toString(),"010");
                    //将中文转换为地址编码
                    geocodeSearch.getFromLocationNameAsyn(query);
                }
            }
        });

    }

解决方案

//在onCreat方法中给aMap对象赋值
setContentView(R.layout.basicmap_activity);

解决方案二:

你最好把代码贴一下,直接看错误提示估计是高歌地图没有初始化

解决方案三:

savedInstanceState为空,mapView.onCreate()调用它报错,建议看一下demo是不是要加判断条件或者给它初始化之类的。

时间: 2024-09-16 01:54:39

整合高德地图时报错bundle为空的相关文章

spring java web-springMVC与Mybatis整合开发项目时报错

问题描述 springMVC与Mybatis整合开发项目时报错 错误提示: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component StandardEngine[Catalina].StandardHost[localhost].StandardContext[/erp![]]图片说明 解决方案 http://segmentfault.co

shiro ehcache-shiro整合ehcache时报错

问题描述 shiro整合ehcache时报错 5C shiro整合ehcacheapplication-shiro.xml中相关配置: <bean id=""securityManager"" class=""org.apache.shiro.web.mgt.DefaultWebSecurityManager""> <property name=""realm"" re

sdk-有人用过高德地图的Android SDK嘛、为什么显示地图的时候R老是报错

问题描述 有人用过高德地图的Android SDK嘛.为什么显示地图的时候R老是报错 解决方案 高德地图android sdk 地图显示和定位 基本使用方法 解决方案二: 跟R应该没关系,R是自动生成的. 解决方案三: 看下你的包有没有正确导入,我看它是灰的. 解决方案四: R文件是自动生成的. 应该是你的程序有错误..仔细检查一下吧

急,求高手!!hive在向整合hbase的分区表插入数据时报错:Must specify table

问题描述 急,求高手!!hive在向整合hbase的分区表插入数据时报错:Must specify table hadoop版本:hadoop-2.7.12.7.1 hbase版本:hbase-1.1.2 hive版本:apache-hive-2.0.0-bin 本人是新手,在整合了hive和hbase之后,我在hive中创建了一张关联了hbase表的分区表,然后在向表插入数据的时候报错了,下面是插入语句和报错,求懂的人解答. visited_in_hive是关联了hbase表,准备插入数据的表

hbase-Hive中在整合HBase的表中插入数据时报错

问题描述 Hive中在整合HBase的表中插入数据时报错 伪分布式模式下整合Hadoop 2.2.0(自己基于Ubuntu 64位系统编译的)+HBase 0.98+Hive 0.14,其他功能操作都正常,但是在Hive中往基于HBase存储的表中插入数据时报错,网上找了很多方法,但都没用,具体错误如下: java.lang.IllegalArgumentException: Can not create a Path from an empty string at org.apache.had

spring springmvc mybatis整合时,tomcat启动正常,查询数据库时报错

问题描述 spring springmvc mybatis整合时,tomcat启动正常,查询数据库时报错 Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YE

我的一个SSH简单整合,启动tomcat时报错,如error文档内容所示,请教指点

问题描述 我的一个SSH简单整合,启动tomcat时报错,如:error文档 内容所示,请教指点,项目源代码及项目结构图都在压缩包中,随时等候佳音,谢谢了-- 解决方案 你的UesrBean.hbm.xml的路径写错了不是<class name="com.bean.UserBean" table="users">而是<class name="com.bean.user.UserBean" table="users&qu

sdk-xcode中使用git提交时报错The working copy&amp;amp;quot;H5Service.bundle&amp;amp;quot;

问题描述 xcode中使用git提交时报错The working copy"H5Service.bundle" The working copy"H5Service.bundle" failed to commit files.我用到了芝麻信用的SDK,需要导入H5Service.bundle,使用没问题,但是git提交时报了这么个错误,有知道怎么解决的吗? 解决方案 这个文件没意见加到版本控制吧 git add添加

sqlite-在更新和删除SQLite数据库时报错NullPointerException

问题描述 在更新和删除SQLite数据库时报错NullPointerException 我的Activity首先打开了数据库. private DBAdapter dbAdepter; dbAdepter = new DBAdapter(this); dbAdepter.open(); 然后更新操作如下: public class Heimingdan_Alter extends Activity { private DBAdapter dbAdepter; private EditText e