To write signature in app ….use this gesture code.
Write this gesture in xml:
<android.gesture.GestureOverlayView
android:id=”@+id/signaturePad” android:layout_width=”match_parent” android:layout_height=”0dp” android:layout_weight=”5″ android:background=”#FFFFFF” android:eventsInterceptionEnabled=”true” android:fadeEnabled=”false” android:gestureColor=”#000000″ android:gestureStrokeLengthThreshold=”0.1″ android:gestureStrokeWidth=”2″ android:gestureStrokeType=”multiple” android:fadeOffset=”5184000000″ android:orientation=”vertical” >
</android.gesture.GestureOverlayView>
Write this java:
gestureView = (GestureOverlayView) findViewById(R.id.signaturePad);
gestureView.setDrawingCacheEnabled(true);
For storing this in device:
bm = Bitmap.createBitmap(gestureView.getDrawingCache());
File f = new File(Environment.getExternalStorageDirectory() + File.separator + “androidsignature.png”);
f.createNewFile();
if(f.exists()){
Toast.makeText(Signature.this, “Signature SavednPath::”+f.toString(), Toast.LENGTH_LONG).show();
Log.v(“path::”, f.toString());
FileOutputStream os = new FileOutputStream(f);
os = new FileOutputStream(f);
//compress to specified format (PNG), quality – which is ignored for PNG, and out stream bm.compress(Bitmap.CompressFormat.PNG, 00, os);
os.close();
}