protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Achievement); AchievementManager achMan = new AchievementManager(); List<string> achievements = achMan.GetAchievementsForGUI(); List<string> achievementText = new List<string>(); foreach (var item in achievements) { achievementText.Add(item.Split('=')[0]); } ListView listviewAchievements = FindViewById<ListView>(Resource.Id.listViewAchievements); listviewAchievements.Adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, achievementText); listviewAchievements.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var bla = e.Id; // Handle the click event string lblText = (e.View as TextView).Text; if (achievements[Convert.ToInt32(e.Id)].Split('=')[1] == "V") { ShareAchievement(lblText); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); AchievementManager achMan = new AchievementManager(); TBSAchievements source = new TBSAchievements(achMan.GetAchievementsForGUI().ToArray()); source.OnRowSelected += (object sender, TBSAchievements.RowSelectedEventArgs e) => { if (CheckColor(tbAchievements.Source.GetCell(tbAchievements, e.indexPath).BackgroundColor)) { ShareAchievement(tbAchievements.Source.GetCell(tbAchievements, e.indexPath).TextLabel.Text); } tbAchievements.DeselectRow(e.indexPath, true); }; tbAchievements.Source = source; tbAchievements.ReloadData(); }