protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_first);

            db = new Userdatabase();
            db.createDatabase();

            MainActivity.username = "******";
            loading_text          = FindViewById <TextView>(Resource.Id.txt_loading);
            mProgress             = (ProgressBar)FindViewById(Resource.Id.progress_bar);

            if (db.confirmTable(MainActivity.username) == 0)
            {
                try
                {
                    Users users = new Users
                    {
                        Name = MainActivity.username,
                    };
                    db.insertIntoTable(users);
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show();
                }
            }

            timer = new Timer
            {
                Interval = 100 // 1 second
            };
            timer.Elapsed += Timer_Elapsed1;
            timer.Start();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_start);

            db = new Userdatabase();
            db.createDatabase();

            /*if (db.confirmTable(MainActivity.username) == 0)
             * {
             *  Save_username();
             * }*/

            button_start  = FindViewById <Button>(Resource.Id.btn_start);
            button_resume = FindViewById <Button>(Resource.Id.btn_resume);
            button_exit   = FindViewById <Button>(Resource.Id.btn_exit);
            title_text    = FindViewById <TextView>(Resource.Id.txt_title);
            user_text     = FindViewById <TextView>(Resource.Id.txt_username);
            newuser_text  = FindViewById <TextView>(Resource.Id.txt_newuser);
            olduser_text  = FindViewById <TextView>(Resource.Id.txt_olduser);
            linear_resume = FindViewById <LinearLayout>(Resource.Id.linear_resume);

            user_text.Text = "Welcome " + MainActivity.username;

            Spinner spinner_cate = FindViewById <Spinner>(Resource.Id.spinner_category);

            spinner_cate.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_cate_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.category_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner_cate.Adapter = adapter;

            Spinner spinner_level = FindViewById <Spinner>(Resource.Id.spinner_level);

            spinner_level.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_level_ItemSelected);
            var adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.level_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner_level.Adapter = adapter1;

            Typeface tf1 = Typeface.CreateFromAsset(Assets, "Sketch.ttf");
            Typeface tf2 = Typeface.CreateFromAsset(Assets, "Romantic Beach.ttf");
            Typeface tf3 = Typeface.CreateFromAsset(Assets, "Sin City.ttf");
            Typeface tf4 = Typeface.CreateFromAsset(Assets, "SouthernAire_Personal_Use_Only.ttf");

            title_text.Typeface = tf4;

            Show_resumlinear();

            newuser_text.Click += delegate
            {
                LayoutInflater layoutInflater = LayoutInflater.From(this);
                View           view           = layoutInflater.Inflate(Resource.Layout.user_input_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertbuilder.SetView(view);
                alertbuilder.SetPositiveButton("Create", (EventHandler <DialogClickEventArgs>)null);
                alertbuilder.SetNegativeButton("Cancel", (EventHandler <DialogClickEventArgs>)null);
                nameedit    = view.FindViewById <EditText>(Resource.Id.edit_name);
                titl_dialog = view.FindViewById <TextView>(Resource.Id.dialogTitle);
                alertbuilder.SetCancelable(false);
                Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
                dialog.Show();
                var createBtn = dialog.GetButton((int)DialogButtonType.Positive);
                var cancelBtn = dialog.GetButton((int)DialogButtonType.Negative);
                createBtn.Click += (sender, args) =>
                {
                    string m_username = nameedit.Text;
                    if (m_username.Equals(""))
                    {
                        titl_dialog.Text = "You have no name";
                    }
                    else
                    {
                        if (db.confirmTable(m_username) == 0)
                        {
                            MainActivity.username = m_username;
                            user_text.Text        = "Welcome " + MainActivity.username;
                            Save_username();
                            dialog.Dismiss();
                        }
                        else
                        {
                            titl_dialog.Text = "This user is already";
                        }
                    }
                };
                cancelBtn.Click += (sender, args) =>
                {
                    // Dismiss dialog.
                    Console.WriteLine("I will dismiss now!");
                    dialog.Dismiss();
                };
            };

            olduser_text.Click += delegate
            {
                LayoutInflater layoutInflater = LayoutInflater.From(this);
                View           view           = layoutInflater.Inflate(Resource.Layout.username_select_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertbuilder.SetView(view);
                userlist = view.FindViewById <ListView>(Resource.Id.list_user);
                alertbuilder.SetNegativeButton("Cancel", (EventHandler <DialogClickEventArgs>)null);
                alertbuilder.SetCancelable(false);
                Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
                dialog.Show();
                var cancelBtn = dialog.GetButton((int)DialogButtonType.Negative);

                listSource = db.selectTable();
                var adapter11 = new UserListAdapter(this, listSource);
                userlist.Adapter         = adapter11;
                this.userlist.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    string name111 = listSource[e.Position].Name;
                    MainActivity.username = name111;
                    user_text.Text        = "Welcome " + MainActivity.username;
                    dialog.Dismiss();
                };
                cancelBtn.Click += (sender, args) =>
                {
                    // Dismiss dialog.
                    Console.WriteLine("I will dismiss now!");
                    dialog.Dismiss();
                };
            };

            button_start.Click += delegate
            {
                MainActivity.arrayname = flag_category;
                MainActivity.levelname = flag_level;
                if (!flag_category.Equals("-- Select --"))
                {
                    Click_Start();
                }
                else
                {
                    Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert = dialog.Create();
                    alert.SetTitle("Warning!");
                    alert.SetMessage("Please select a category");
                    alert.SetButton("OK", (c, ev) =>
                    {
                    });
                    alert.Show();
                }
            };

            button_exit.Click += delegate
            {
                Exit();
            };
        }