Xamarin android将id从一个活动带到下一个活动

时间:2017-04-27 09:17:09

标签: android rest xamarin

我正在使用xamarin android从api中提取休息数据。我反序列化数据并将其显示在像private void

这样的列表中
ParseAndDisplay(JsonValue json)
        {
            var lstData = FindViewById<ListView>(Resource.Id.listView1);
            List<Team> list_teams = new List<Team>();
            RootObject objs = JsonConvert.DeserializeObject<RootObject>(json.ToString());
            foreach (var obj in objs.teams)
            {
                var id = obj._links.self.href;
                var indexOfLastBackSlash = id.LastIndexOf("/") + 1;
                id = id.Substring(indexOfLastBackSlash);

                Team team = new Team();
                team.name = obj.name;
                list_teams.Add(team);
                var slist = new List<string>();
                foreach (Team t in list_teams)
                {
                    string s = t.name;
                    slist.Add(s);
                }
                var data = new string[] { };
                data = slist.ToArray();
                lstData.Adapter = new ArrayAdapter(this, Resource.Layout.listViewTemplate, data);
                //lstTeams.Visibility = ViewStates.Visible;
                //ListView lstTeams = FindViewById<ListView>(Resource.Id.lstTeams);
                //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, Convert.ToInt32(list_teams));
                // ListAdapter = new ArrayAdapter
            }

我想从列表中选择一个团队并在其上显示更多详细信息,我将需要此ID。如何选择项目并传递这些细节?

0 个答案:

没有答案