摘要:
//在不支持多点触屏的设备上实现地图的放大缩小 //开启内置缩放控制,在地图下方显示2个缩放按钮 Private MapView mapView=... mapView.setBulitInZoomControls(true); //设置地图等级 mapView.setZoom(12); //通过编程方式控制 获得MapController对象 MapController mc=mapView.getController(); 放大缩小分别利用MapController的zoomIn()和zoomOut()方法 改变地图视图
mapView.setSatelli... 阅读全文
摘要:
LocationManager locationManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE); //定义一个监听器来响应位置的更新 LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { useNewLocation(location); } public voi... 阅读全文
摘要:
以get方式发送HTTP请求:private Thread getThread; getThread = new Thread() { public void run() { HttpClient client = new DefaultHttpClient(); HttpGet getMethod = new HttpGet(REQUEST_URL); HttpResonse response = null; try { response = clien... 阅读全文
摘要:
写文件: FileOutputStream out = null;
try
{ out = openFileOutput(filename, MODE_PRIVATE); byte[] content = (写入的文本).getBytes(); out.write(content);
}
catch(Exception e)
{ e.printStackTrace();
}
finally
{ if(out != null) { try { out.close(); } ... 阅读全文
摘要:
Activity之间的消息传递:Activity1:
Intent intent=new intent(Activity1.this,Activity2.clas);
Bundle data=new data();
data.putString("name",name);
intent.putExtras(data);
StartActivity(intent); Activity2:
Intent intent=getIntent();
Bundle data=intent.getExtras();
String name=data.getString("nam 阅读全文