Sunday, October 13, 2013

Need a Bitmap image of TabHost Layout

Hi friends am new to android. I created an application form filling with 4 tabs & now I need a screen shot of the layout if its edit text is filled on button click of save. Is it possible to do in android, if not in any format yet i want a copy of the fields with its image

Calendar.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {    // TODO Auto-generated method stub     loadBitmapFromView((R.id.utils);}});}public static Bitmap loadBitmapFromView(View v) {    Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width,         v.getLayoutParams().height, Bitmap.Config.ARGB_8888);                    Canvas c0 = new Canvas(b);    v.measure(v.getWidth(),v.getHeight());    v.layout(1,1,v.getWidth(),v.getHeight());    v.draw(c0);    return b;}

Hi in the above code its a relative layout where i tried for the layout output as image yet it shows error as width & height > 0

try this it may assist you

 public static Bitmap loadBitmapFromView(View v) {              Bitmap b = Bitmap.createBitmap( v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);                              Canvas c = new Canvas(b);              v.measure(v.getWidth(),v.getHeight());              v.layout(0,0,v.getWidth(),v.getHeight());              v.draw(c);              return b;        }

No comments:

Post a Comment