I'm new to Xamarin. I want to implent a signature pad when the user clicks a button and save the signature to a variable. I want to use this signature pad https://components.xamarin.com/view/signature-pad and I tried to implement the pad as described.
I dont get any errors, but my problem is, that the signature pad appears and I can do the signature and then i can't save the signature, because there's no button. If I click the "back" button of the android phone, the activity which called the signature pad is closed.
Picture on Android phone: no save button
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Uri = Android.Net.Uri;
using Environment = Android.OS.Environment;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Provider;
using Android.Content.PM;
using Xamarin.Forms;
using Java.IO;
using SignaturePad;
namespace iSTA
{
[Activity(Label = "Zähler Einbau")]
public class ZEinbau : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your application here
SetContentView(Resource.Layout.ZEinbau);
Android.Graphics.Bitmap unterschrift;
//some other code
//Button Unterschrift
Android.Widget.Button btnUnterschrift = FindViewById<Android.Widget.Button>(Resource.Id.btnUnterschrift);
btnUnterschrift.Click += delegate
{
SignaturePadView sp = new SignaturePadView(this);
AddContentView(sp, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
unterschrift = sp.GetImage(); ;
};
//some other code
}
}