title: How can i take screenshot of the blackberry home screen from inside my application?
body: <p>How can I take the <a href="http://en.wikipedia.org/wiki/Screenshot" rel="nofollow">screenshot</a> of the <a href="http://www.google.com/search?hl=en&amp;client=firefox-a&amp;hs=rJ7&amp;rls=org.mozilla%3aen-US%3aofficial&amp;tbm=isch&amp;ct=mode&amp;cd=2&amp;q=Blackberry%20Home%20Screens&amp;spell=1&amp;sa=X&amp;sout=0&amp;ei=RQCXT6CkIYLTrQfNkrXeDQ&amp;ved=0CCoQxxQ&amp;biw=1304&amp;bih=662&amp;sei=UgCXT4nuPIrirAedg9nxDQ" rel="nofollow">Home Screen</a> (Main display screen) of the Blackberry device from inside my application (to use it as a background image in my app)?
  I've used <a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/system/Display.html#screenshot%28net.rim.device.api.system.Bitmap%29" rel="nofollow"><code>Display.screenshot(bm)</code></a> but it takes screen-shot of the current screen of my application and I need the screen-shot of the Home Screen of my device.</p>
  
  <pre class="lang-java prettyprint-override"><code>private class CaptureThread extends Thread {
  
      public CaptureThread() {
      }
  
      public void run() {
          FileConnection fc = null;
          DataOutputStream out = null;
  
          try {
  
              // MainScreen objMainScreen=new MainScreen();
  
              int width = Display.getWidth();
              // int width=objMainScreen.getWidth();
              int height = Display.getHeight();
  
              Bitmap bm = new Bitmap(width, height);
              Display.screenshot(bm);
  
              PNGEncodedImage png = PNGEncodedImage.encode(bm);
  
              // Save the PNG to the micro SD card.
              fc = (FileConnection) Connector
                      .open("file:///SDCard/BlackBerry/pictures/screenCap.png");
  
              if (fc.exists()) {
                  fc.delete();
              }
  
              fc.create();
  
              out = fc.openDataOutputStream();
              out.write(png.getData());
          } catch (Exception ex) {
              System.out.println("Exception: " + ex.toString());
          } finally {
  
              if (out != null) {
                  try {
                      out.close();
                  } catch (IOException e) {
                  }
              }
  
              if (fc != null) {
                  try {
                      fc.close();
                  } catch (IOException e) {
                  }
              }
          }
      }
  }
  </code></pre>