Thursday, 13 August 2015

Signature Option in Android



  1. CREATE NEW ACTIVITY (SIGNATURE) --- SHOULD DECLARE IN MANIFEST.XML
  2. USING (startActivityForResult ()) CALL SIGNATURE ACTIVITY
  3. SAVE SIGNATURE PNG IN MEDIA STORAGE. 
  4. CONVERT .PNG FILE TO BASE64 FORMAT FOR EASY SHARE  
  5. SEND BACK TO MAIN ACTIVITY WITH BUNDLE VALUE 
  6. ACCESS THE BUNDLE VALUE USING (onActivityResult) FOR PROCESS.








1. ADD UTILITY.JAVA IN PROJECT PACKAGE
CLICK HERE TO ACCESS UTILITY.JAVA 

2. CREATE MYSIGNATURE ACTIVITY IN PROJECT PACKAGE - 
CLICK HERE TO ACCESS MySignature.java


3. CALL SIGNATURE ACTIVITY  FROM USER ACTIVITY


public static final int SIGNATURE_ACTIVITY = 1;
Intent intent = new Intent(ctx, MySignature.class); 

startActivityForResult(intent,SIGNATURE_ACTIVITY);



4. GET SIGNATURE ACTIVITY  TO USER ACTIVITY

publicprotected void onActivityResult(int requestCode, int resultCode, Intent data)

    {
        switch(requestCode) {
        case SIGNATURE_ACTIVITY: 
            if (resultCode == RESULT_OK) {
                 Bundle bundle = data.getExtras();
                String status  = bundle.getString("status");
                String data1  = bundle.getString("data");
                if(status.equalsIgnoreCase("done")){
   Toast toast = Toast.makeText(this, "Signature capture successful!",                                              Toast.LENGTH_SHORT);
   toast.setGravity(Gravity.TOP, 105, 50);
   toast.show();
                }
            }
            break;
        }
    }
















No comments:

Post a Comment

How to do text writing animation?  In Android Development we do not have the option to use any other custom font in our default Tex...