View content = findViewById(R.id.mainlayout); content.setDrawingCacheEnabled(true); Bitmap b = content.getDrawingCache(); File sdCard = Environment.getExternalStorageDirectory(); File file = new File(sdCard,"zzImage.jpg"); if(file.exists()){ file.delete(); } try { b.compress(CompressFormat.JPEG, 100, new FileOutputStream(file)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }
Another thought is that your drawing cache may be defaulting to a width/height of 0,0. According to the Android docs you may be missing a call to createBitmap(). And, that method calls for a width, height and Bitmap.Config.Here's a code snippet that will hopefully re-point you down the right track:View map = findViewById(R.id.map); bitmap = Bitmap.createBitmap(map.getWidth(), map.getHeight(), Bitmap.Config.RGB_565);If you already tried this, can you list out what patterns you've tried?-Andy
View map = findViewById(R.id.map); bitmap = Bitmap.createBitmap(map.getWidth(), map.getHeight(), Bitmap.Config.RGB_565);
I'm just guessing that this has do with MapView when you serialize/deserialize it as a bitmap at the bytecode level. Did you try any patterns similar to this link: http://www.brighthub.com/mobile/google-android/articles/30676.aspx?-Andy
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.