Capturing Screen Issue

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Capturing Screen Issue

Postby BlackMesa » Tue Mar 31, 2009 8:59 am

Hi!

I'm trying to get screenshot of GLSurfaceView sample with the following code in CubeRenderer's drawFrame() method:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. b = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
  2.  
  3. c = new Canvas(b);
  4.  
  5. GLSurfaceViewActivity.mGLSurfaceView.draw(c);
  6.  
  7. CubeRenderer.SavePNG(b, "__screen00.png");/**/
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


SavePNG() code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public static void SavePNG(Bitmap bmp, String name)
  2.  
  3. {
  4.  
  5.   try
  6.  
  7.   {
  8.  
  9.     FileOutputStream fos = new FileOutputStream("/sdcard/" + name);
  10.  
  11.     bmp.compress(CompressFormat.PNG, 100, fos);
  12.  
  13.            
  14.  
  15.     try
  16.  
  17.     {
  18.  
  19.       fos.flush();
  20.  
  21.     }
  22.  
  23.     catch(IOException e)
  24.  
  25.     {
  26.  
  27.       e.printStackTrace();
  28.  
  29.     }
  30.  
  31.     try
  32.  
  33.     {
  34.  
  35.       fos.close();
  36.  
  37.     }
  38.  
  39.     catch(IOException e)
  40.  
  41.     {
  42.  
  43.       e.printStackTrace();
  44.  
  45.     }
  46.  
  47.   }
  48.  
  49.   catch(FileNotFoundException e)
  50.  
  51.   {
  52.  
  53.     e.printStackTrace();
  54.  
  55.   }
  56.  
  57. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Resulting image in __screen00.png is entire white. SDK version is 1.1_r1.
Can't imagine what's the essence of the problem(( Any ideas?
BlackMesa
Freshman
Freshman
 
Posts: 2
Joined: Wed Mar 11, 2009 10:48 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests