Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Find the WebView that Phonegap uses?
  2. super.loadUrl("file:///android_asset/www/index.html");
  3.        
  4. public void onCreate(Bundle savedInstanceState) {
  5.     super.onCreate(savedInstanceState);
  6.     super.loadUrl("file:///android_asset/www/index.html");
  7.  
  8.  
  9.     View html = (View)super.appView.getParent();
  10.     Bitmap bm2 = Bitmap.createBitmap(200, 300, Bitmap.Config.ARGB_8888);
  11.     Canvas c2 = new Canvas(bm2);
  12.     html.draw(c2);
  13.  
  14.     OutputStream stream = null;
  15.     try {
  16.       stream = new FileOutputStream(Environment.getExternalStorageDirectory() +"/bm2.png");
  17.       bm2.compress(CompressFormat.PNG, 80, stream);
  18.       if (stream != null) stream.close();
  19.     } catch (IOException e) {
  20.     } finally {
  21.       bm2.recycle();
  22.     }
  23.  
  24. }//end