|
1 package tz.signaturecapture; |
|
2 |
|
3 import android.app.Activity; |
|
4 import android.content.Intent; |
|
5 import android.os.Bundle; |
|
6 import android.view.Gravity; |
|
7 import android.view.View; |
|
8 import android.widget.Button; |
|
9 import android.widget.Toast; |
|
10 |
|
11 public class CaptureSignatureActivity extends Activity { |
|
12 |
|
13 public static final int SIGNATURE_ACTIVITY = 1; |
|
14 |
|
15 @Override |
|
16 public void onCreate(Bundle savedInstanceState) { |
|
17 super.onCreate(savedInstanceState); |
|
18 setContentView(R.layout.main); |
|
19 |
|
20 Button getSignature = (Button) findViewById(R.id.signature); |
|
21 getSignature.setOnClickListener(new View.OnClickListener() { |
|
22 public void onClick(View view) { |
|
23 Intent intent = new Intent(CaptureSignatureActivity.this, CaptureSignature.class); |
|
24 startActivityForResult(intent,SIGNATURE_ACTIVITY); |
|
25 } |
|
26 }); |
|
27 } |
|
28 |
|
29 protected void onActivityResult(int requestCode, int resultCode, Intent data) |
|
30 { |
|
31 switch(requestCode) { |
|
32 case SIGNATURE_ACTIVITY: |
|
33 if (resultCode == RESULT_OK) { |
|
34 |
|
35 Bundle bundle = data.getExtras(); |
|
36 String status = bundle.getString("status"); |
|
37 if(status.equalsIgnoreCase("done")){ |
|
38 Toast toast = Toast.makeText(this, "Signature capture successful!", Toast.LENGTH_SHORT); |
|
39 toast.setGravity(Gravity.TOP, 105, 50); |
|
40 toast.show(); |
|
41 } |
|
42 } |
|
43 break; |
|
44 } |
|
45 |
|
46 } |
|
47 |
|
48 } |