请问一下这是什么问题,谢谢
package com.example.gpstest; import com.baidu.mapapi.BMapManager; import com.baidu.mapapi.LocationListener; import com.baidu.mapapi.MKLocationManager; import com.baidu.mapapi.MapActivity; import android.location.Location; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends MapActivity { private BMapManager mapManager; private MKLocationManager mLocationManager = null; TextView t1; TextView t2; Button b; Location location; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mapManager = new BMapManager(getApplication()); mapManager.init("937F85AE5C083238578F13AFEF100E9201839AA2", null); setContentView(R.layout.activity_main); t1 = (TextView)findViewById(R.id.textView1); t2 = (TextView)findViewById(R.id.textView2); b = (Button)findViewById(R.id.button1); super.initMapActivity(mapManager); mLocationManager = mapManager.getLocationManager(); // 注册位置更新事件 mLocationManager.requestLocationUpdates((LocationListener) this); // 使用GPS定位 mLocationManager.enableProvider((int) MKLocationManager.MK_GPS_PROVIDER); b.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub t1.setText("当前经度:" + location.getLongitude()); t2.setText("当前纬度:" + location.getLatitude()); }}); } public void onLocationChanged(Location location) { if (location != null) { // 显示定位结果 location.getLongitude(); location.getLatitude(); } } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } }
在Manfies文件中声明了这个Activity了吗?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。