protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Set Toolbar SupportToolbar Toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(Toolbar); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); setToolBar = new mySetToolBar(this, ref Toolbar, ApplicationContext); button = new buttonEvent(BtnScan_Click, testBtn_Click); EditText mainSearchBar = FindViewById <EditText>(Resource.Id.editTextMain); mainSearchBar.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { Console.WriteLine("Enter detected\n"); var passSearchInfo = new Intent(this, typeof(Search)); passSearchInfo.PutExtra("search", mainSearchBar.Text); StartActivity(passSearchInfo); e.Handled = true; } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Search); var find = FindViewById <EditText>(Resource.Id.searchBar); var Main = FindViewById <TextView>(Resource.Id.text_toolbar_title); //get intent input //set toolbar SupportToolbar Toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(Toolbar); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); setToolBar = new mySetToolBar(this, ref Toolbar, ApplicationContext); // back to main page string mainAcitivityText = Intent.GetStringExtra("search") ?? "no data"; if (mainAcitivityText != "no data") { Console.WriteLine("get data from main!\n"); find.Text = mainAcitivityText; searchInit(mainAcitivityText); } //setup list view Main.Click += delegate { var main = new Intent(this, typeof(MainActivity)); StartActivity(main); }; find.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { searchInit(e.Text.ToString()); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.student); //set toolbar SupportToolbar Toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(Toolbar); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); setToolBar = new mySetToolBar(this, ref Toolbar, ApplicationContext); var sqlLiteFilePath = GetFileStreamPath("") + "/db_user.db"; var name = FindViewById <EditText>(Resource.Id.studentName); var stuID = FindViewById <EditText>(Resource.Id.studentID); var payed = FindViewById <RadioButton>(Resource.Id.radioYes); var insert = FindViewById <Button>(Resource.Id.addUser); var Main = FindViewById <TextView>(Resource.Id.text_toolbar_title); string response; insert.Click += delegate { string payment = "false"; if (payed.Checked) { payment = "true"; } response = insertDB(sqlLiteFilePath, name.Text, stuID.Text, payment, "male"); Toast.MakeText(this, response, ToastLength.Short).Show(); }; Main.Click += delegate { var main = new Intent(this, typeof(MainActivity)); StartActivity(main); }; // Create your application here }