问题描述
- google map android程序在模拟器定位出现问题
-
我能在模拟器上跑出来google map但是加了一下代码之后按按钮就直接崩溃了。求解答!!> searchBt=(Button)findViewById(R.id.btnSearch); searchBt.setOnClickListener(new OnClickListener(){ public void onClick(View v) { EditText etLongitude = (EditText) findViewById(R.id.etLongitude); EditText etLatitude = (EditText) findViewById(R.id.etLatitude); if (etLongitude.getText().toString().equals("") || etLatitude.getText().toString().equals("")) { // 判断是否输入空值 showDialog(" 不能为空"); } else { longitude = Double.parseDouble(etLongitude.getText().toString()); latitude = Double.parseDouble(etLatitude.getText().toString()); refreshMapView(); // 调用方法更新Map } } }); } private void refreshMapView() { // TODO Auto-generated method stub GeoPoint p = new GeoPoint((int)(longitude* 1E6), (int)(latitude* 1E6)); mMapView01.displayZoomControls(true); mMapController01.animateTo(p); mMapController01.setZoom(intZoomLevel); } protected boolean isRouteDisplayed() { return false; } private void showDialog(String mess){ new AlertDialog.Builder(MainActivity.this).setTitle("Message") .setMessage(mess) .setNegativeButton("经度纬度请补全", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }) .show();
时间: 2024-08-22 14:29:36