protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here SetContentView(Resource.Layout.CategoriesLayout); list_items = new List<string>(); list_items.Add("What is an automaton?"); list_items.Add("Languages and automata"); list_items.Add("Generative grammars for the four languages"); list_items.Add("The pumping lemma"); list_items.Add("Determinism and non-determinism"); categoriesList = FindViewById<ListView>(Resource.Id.CategoriesList); MyListViewAdapter adapter = new MyListViewAdapter(this, list_items); categoriesList.Adapter = adapter; categoriesList.ItemClick += categoriesList_ItemClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here SetContentView(Resource.Layout.QuizesLayout); list_items1 = new List<string>(); list_items1.Add("Quiz - What is an automaton?"); list_items1.Add("Quiz - Languages and automata"); list_items1.Add("Quiz - Generative grammars for the four languages"); list_items1.Add("Quiz - Determinism and non-determinism"); quizesList = FindViewById<ListView>(Resource.Id.QuizesList); MyListViewAdapter adapter1 = new MyListViewAdapter(this, list_items1); quizesList.Adapter = adapter1; quizesList.ItemClick += quizesList_ItemClick; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); myListView = FindViewById <AbsListView>(Resource.Id.myListView); items = new List <MyPerson>() { new MyPerson() { FirstName = "Pesho", LastName = "Peshev", Age = 20, Gender = "MALE" }, new MyPerson() { FirstName = "Gosho", LastName = "Goshov", Age = 18, Gender = "MALE" }, new MyPerson() { FirstName = "Tosho", LastName = "Toshov", Age = 25, Gender = "MALE" } }; MyListViewAdapter adapter = new MyListViewAdapter(this, items); }
/// <summary> /// Method for loading data into the listview /// </summary> private void LoadData() { mProgressBar = FindViewById <ProgressBar>(Resource.Id.leaderboardProgressBar); Task.Factory.StartNew(() => { RunOnUiThread(() => mProgressBar.Visibility = ViewStates.Visible); if (DbConnector.OpenSQLConnection()) { // Connection opened PlayerStatsDA statsDA = new PlayerStatsDA(); mItems = statsDA.GetAllStats(); RunOnUiThread(() => { // Refresh ListView mAdapter = new MyListViewAdapter(this, mItems); mListView.Adapter = mAdapter; }); } else { // Connection could not be opened string error = "Connection to the database could not be established."; RunOnUiThread(() => { //Enabling the controls back AlertGenerator.ShowError(error, this); }); } DbConnector.CloseSQLConnection(); // Close connection to the database RunOnUiThread(() => mProgressBar.Visibility = ViewStates.Gone); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Signup); /* mButtonSignUp = FindViewById<Button>(Resource.Id.buttonSignUp); * mButtonSignUp.Click += (object sender, System.EventArgs e) => * { * FragmentTransaction transaction = FragmentManager.BeginTransaction(); * DialogSignUp signUpDialog = new DialogSignUp(); * signUpDialog.Show(transaction, "Dialog Fragment"); * * };*/ mlistView = FindViewById <ListView>(Resource.Id.listview1); mItems = new List <Person>(); mItems.Add(new Person("Doe", "John", "36", "Homme")); mItems.Add(new Person("Daiki", "Aomine", "18", "Homme")); mItems.Add(new Person("Saitama", "Gion", "32", "Homme")); //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleExpandableListItem1, mItems); MyListViewAdapter adapter = new MyListViewAdapter(this, mItems); mlistView.Adapter = adapter; }
//Get a list of top 10 players ordered by score, pass it to the custom listview adapter and attach the adapter to the listview. protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.highScores); var db = new DataManager(); MyList = db.GetHighScoreList(); MyListViewAdapter myAdapter = new MyListViewAdapter(this, MyList); MyListView = FindViewById <ListView>(Resource.Id.listHighScores); MyListView.Adapter = myAdapter; }
void ListFolders() { FolderNames = new List <string>(); foreach (Folder folder in _db.QueryAllFolders()) { FolderNames.Add(folder.Name); Toast.MakeText(this, FolderNames.ToString(), ToastLength.Short).Show(); } MyListViewAdapter adapter = new MyListViewAdapter(this, FolderNames); listFolders.Adapter = adapter; }
private void BtnFind_Click(object sender, EventArgs e) { searchedUsers = (from x in PopulateListView() where (x.username).ToLower().Contains(txtFindUsers.Text.ToLower()) && !(x.username).Equals(currentUser.username) select x).ToList <LoginTable>(); MyListViewAdapter adapter = new MyListViewAdapter(this, Resource.Layout.ListView_FindUsers, searchedUsers, currentUser); lvResults.Adapter = adapter; if (searchedUsers.Count == 0) { Toast.MakeText(this, "No Results", ToastLength.Short).Show(); } }
/// <summary> /// Override OnCreate method /// </summary> /// <param name="savedInstanceState"></param> protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_leaderboard); // Set the activity back button on the actionbar SupportActionBar.SetDisplayHomeAsUpEnabled(true); mListView = FindViewById <ListView>(Resource.Id.leaderboardListView); mItems = new List <PlayerStats>(); LoadData(); mAdapter = new MyListViewAdapter(this, mItems); mListView.Adapter = mAdapter; View header = LayoutInflater.Inflate(Resource.Layout.listview_leaderboard, null, false); mListView.AddHeaderView(header); #region Initialization mSwipeLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.leaderboardSwipeLayout); mTvRank = FindViewById <TextView>(Resource.Id.lbTvRank); mTvUsername = FindViewById <TextView>(Resource.Id.lbTvUsername); mTvLvl = FindViewById <TextView>(Resource.Id.lbTvLvl); mTvXP = FindViewById <TextView>(Resource.Id.lbTvXP); mTvSR = FindViewById <TextView>(Resource.Id.lbTvSR); mTvPlayTime = FindViewById <TextView>(Resource.Id.lbTvPlayTime); mTvGolds = FindViewById <TextView>(Resource.Id.lbTvGolds); mTvSilvers = FindViewById <TextView>(Resource.Id.lbTvSilvers); mTvBronzes = FindViewById <TextView>(Resource.Id.lbTvBronzes); mTvRank.Click += MTvRank_Click; mTvUsername.Click += MTvUsername_Click; mTvLvl.Click += MTvLvl_Click; mTvXP.Click += MTvXP_Click; mTvSR.Click += MTvSR_Click; mTvPlayTime.Click += MTvPlayTime_Click; mTvGolds.Click += MTvGolds_Click; mTvSilvers.Click += MTvSilvers_Click; mTvBronzes.Click += MTvBronzes_Click; #endregion mSwipeLayout.Refresh += (o, e) => { LoadData(); mSwipeLayout.Refreshing = false; }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); _mListView = FindViewById<ListView>(Resource.Id.mylistView); fragranceList = new List<FragranceMenu>(); fragranceList.Add(new FragranceMenu(){House = "House", Rating = "Rating", Gender = "Gender", Price = "Price"}); MyListViewAdapter adapter = new MyListViewAdapter(this, fragranceList); _mListView.Adapter = adapter; _mListView.ItemClick += _mListView_ItemClick; _mListView.ItemLongClick += _myListView_ItemLongClick; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.table); var id = "ca-app-pub-5385963311823976~5875287959"; Android.Gms.Ads.MobileAds.Initialize(ApplicationContext, id); var adView = FindViewById <AdView>(Resource.Id.adViewT); var adRequest = new AdRequest.Builder().Build(); adView.LoadAd(adRequest); ListView tableListView = FindViewById <ListView>(Resource.Id.tableList); tournamentID = Intent.GetStringExtra("tournamentID"); tournamentName = Intent.GetStringExtra("tournamentName"); this.Title = tournamentName + " " + "standings"; List <points> getPlayersOnThisTournament = con.db.Query <points>("SELECT * FROM points WHERE tournamentID = '" + tournamentID + "' ORDER BY numOfPoints DESC, goalDiference DESC, awayGoals DESC "); tableListView.ItemClick += delegate(object sender, Android.Widget.AdapterView.ItemClickEventArgs e) { string playerName = getPlayersOnThisTournament[e.Position].playerName; Intent intent = new Intent(this, typeof(stats)); intent.PutExtra("tournamentID", tournamentID); intent.PutExtra("playerName", playerName); intent.PutExtra("tournamentName", tournamentName); StartActivity(intent); }; try { MyListViewAdapter adapter = new MyListViewAdapter(this, getPlayersOnThisTournament); tableListView.Adapter = adapter; } catch (Exception) { } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Kisiler); //BottomNavigationView navigation = FindViewById<BottomNavigationView>(Resource.Id.navigation); //navigation.SetOnNavigationItemSelectedListener(this); mListView = FindViewById <ListView>(Resource.Id.myListView); People.Add(new Person("Dr.Öğr.Üyesi Ahmet ARSLAN", "Mail: [email protected]", "+90 (222) 321 35 50 / 6553", "http://ceng.eskisehir.edu.tr/img/aarslan2.jpg")); People.Add(new Person("Prof.Dr. Yaşar HOŞCAN", "Mail: [email protected]", "+90 (222) 321 35 50 / 6558", "http://ceng.eskisehir.edu.tr/img/aarslan2.jpg")); People.Add(new Person("Assoc.Prof.Dr. Serkan GÜNAL", "Mail: [email protected]", "+90 (222) 321 35 50 / 6567", "http://ceng.eskisehir.edu.tr/img/aarslan2.jpg")); People.Add(new Person(" Assoc.Prof.Dr. Cihan KALELİ", "Mail: [email protected]", "+90 (222) 321 35 50 / 6564", "http://ceng.eskisehir.edu.tr/img/aarslan2.jpg")); MyListViewAdapter adapter = new MyListViewAdapter(this, People); mListView.Adapter = adapter; Button callBtn = FindViewById <Button>(Resource.Id.callButton); callBtn.Click += delegate { onCallClick(); }; Button mailBtn = FindViewById <Button>(Resource.Id.sendMail); mailBtn.Click += delegate { PopupMenu popup = new PopupMenu(this, mailBtn); popup.Inflate(Resource.Layout.popup); String chosenSubject; popup.MenuItemClick += (s, arg) => { chosenSubject = arg.Item.TitleFormatted.ToString(); onSendMailClick(chosenSubject); }; popup.Show(); }; }
/// <summary> /// TvBronze /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MTvBronzes_Click(object sender, EventArgs e) { List <PlayerStats> sortedItems; if (!mBronzesASC) { sortedItems = (from item in mItems orderby item.Bronzes select item).ToList(); } else { sortedItems = (from item in mItems orderby item.Bronzes descending select item).ToList(); } // Refresh ListView mAdapter = new MyListViewAdapter(this, sortedItems); mListView.Adapter = mAdapter; mBronzesASC = !mBronzesASC; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); mList = FindViewById<ListView> (Resource.Id.Lista); list = new List<Person> (); list.Add(new Person() { FirstName = "Nathiel" , Age = "20",Gender = "Male", LastName = "Barros"}); list.Add(new Person() { FirstName = "Amber" , Age = "25",Gender = "Female", LastName = "Arwe"}); list.Add(new Person() { FirstName = "John" , Age = "54",Gender = "Male", LastName = "Winchester"}); MyListViewAdapter adapter = new MyListViewAdapter(this, list); mList.Adapter = adapter; mList.ItemClick += MList_ItemClick; mList.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) => { new AlertDialog.Builder (this) .SetMessage (list[e.Position].LastName).Show(); }; }
/// <summary> /// Override OnOptionsItemSelected method /// </summary> /// <param name="item"></param> /// <returns></returns> public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: Finish(); // Call Finish method when back button is pressed OverridePendingTransition(Resource.Animation.slide_in_top, Resource.Animation.slide_out_bottom); return(true); case Resource.Id.leaderboardSearch: // Clicked on Search button using (View searchView = item.ActionView) { using (mSearchView = searchView.JavaCast <Android.Support.V7.Widget.SearchView>()) { mSearchView.QueryHint = "Search by Username..."; // Set SearchView Hint (Placeholder) text mSearchView.MaxWidth = int.MaxValue; // Set the SearchView max width // Get the value of the SearchView mSearchView.QueryTextChange += (s, e) => { List <PlayerStats> searchedItems = (from stat in mItems where stat.Username.Contains(e.NewText, StringComparison.OrdinalIgnoreCase) select stat).ToList(); // Refresh ListView mAdapter = new MyListViewAdapter(this, searchedItems); mListView.Adapter = mAdapter; e.Handled = true; }; } } return(true); default: return(base.OnOptionsItemSelected(item)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); myListView = FindViewById<ListView>(Resource.Id.myListView); Items = new List<Person>(); Items.Add(new Person() { FirstName = "Sebastian", LasName = "Higuita", Age = "19", Gender = "Male" }); Items.Add(new Person() { FirstName = "Gabriel", LasName = "Martinez", Age = "29", Gender = "Male" }); Items.Add(new Person() { FirstName = "Manuela", LasName = "Palacios", Age = "18", Gender = "Female" }); //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, Items); MyListViewAdapter adapter = new MyListViewAdapter(this, Items); myListView.Adapter = adapter; myListView.ItemClick += myListView_ItemClick; myListView.ItemLongClick += myListView_ItemLongClick; myListView.ItemClick += myListView_ItemClick2; }