Dear Developers!
I'm trying to develop a map application which can save some part of map inside a phone. So, refering to the example of google developer site, I created my activity that using the MapView class to display the location what I want to see. It works. And I attached some code to save that view into png format file using Bitmap and Canvas classes. But it didn't work. One image file was created but it didn't contain any information of the map. I don't know the reason why those codes didn't work and couldn't find any related information on the Web... code is... public class AndroidTest extends MapActivity { MapView mapView; List<Overlay> mapOverlays; Drawable drawable; HelloItemizedOverlay itemizedOverlay; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // build map and mark point mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapOverlays = mapView.getOverlays(); drawable = this.getResources().getDrawable (R.drawable.androidmarker); itemizedOverlay = new HelloItemizedOverlay(drawable); GeoPoint point = new GeoPoint(19240000, -99120000); OverlayItem overlayitem = new OverlayItem(point, "", ""); itemizedOverlay.addOverlay(overlayitem); mapOverlays.add(itemizedOverlay); // copy MapView to canvas Bitmap bitmap = Bitmap.createBitmap(400, 800, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); mapView.draw(canvas); // save it! FileOutputStream fo = null; try { fo = this.openFileOutput("test.png", Context.MODE_WORLD_WRITEABLE); } catch (FileNotFoundException e) { e.printStackTrace(); } bitmap.compress(CompressFormat.PNG, 100, fo); try { fo.flush(); } catch (IOException e) { e.printStackTrace(); } try { fo.close(); } catch (IOException e) { e.printStackTrace(); } } Please, help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---