Advertisement
luisuy7

MainActivity.CS

Jul 4th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using Android.App;
  2. using Android.Widget;
  3. using Android.OS;
  4. using Android.Content.Res;
  5. using Android.Graphics.Drawables;
  6.  
  7. namespace spinnerPic
  8. {
  9.     [Activity(Label = "spinnerPic", MainLauncher = true, Icon = "@drawable/icon")]
  10.     public class MainActivity : Activity
  11.     {
  12.         protected override void OnCreate(Bundle bundle)
  13.         {
  14.             base.OnCreate(bundle);
  15.  
  16.             // Set our view from the "main" layout resource
  17.              SetContentView (Resource.Layout.Main);
  18.  
  19.             string username = "5";
  20.             string password = "5";
  21.  
  22.             EditText txtUser = FindViewById<EditText>(Resource.Id.txtUser);
  23.             EditText txtPass = FindViewById<EditText>(Resource.Id.txtPassword);
  24.             Button btnLogin = FindViewById<Button>(Resource.Id.btnLogin);
  25.             Button btnRegister = FindViewById<Button>(Resource.Id.btnRegister);
  26.  
  27.  
  28.             btnRegister.Click += delegate {
  29.                 StartActivity(typeof(Registration));
  30.             };
  31.  
  32.             btnLogin.Click += delegate {
  33.  
  34.                 if (txtUser.Text == username && txtPass.Text == password) {
  35.                     StartActivity(typeof(frmFeed));
  36.                 }
  37.                 else {
  38.                     Toast.MakeText(this,"Login Failed",ToastLength.Long).Show();
  39.                 }
  40.             };
  41.  
  42.  
  43.  
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement