Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.allstatia);
            myListView = FindViewById<ListView> (Resource.Id.listView1);
            textbox = FindViewById<EditText> (Resource.Id.editText1);
            textbox.Visibility = ViewStates.Invisible;
            textbox.SetY (-210);
            Search = FindViewById<Button> (Resource.Id.button1);
            Search.SetY (-160);
            Search.Click += Search_Click;
            myListView.SetY (0);
            var metrics = Resources.DisplayMetrics;
            myListView.SetMinimumHeight (metrics.HeightPixels);
            string IdStatya = Intent.GetStringExtra ("IdJournal");
            NameStatya = new List<string> ();
            Statya = new List<statya> ();
            Statya = PrasingJournalJSON (IdStatya);
            Themes = new List<string> ();
            SectionName = new List<string> ();
            foreach (statya ST in Statya) {
                if (Themes == null) {
                    Themes.Add (ST.Section);
                } else {
                    for (int i = 0; i < Themes.Count; i++) {
                        if (ST.Section == Themes [i]) {
                            sravn = true;
                        }
                    }
                    if (sravn == false) {
                        Themes.Add (ST.Section);
                    } else {
                        sravn = false;
                    }
                }
            }
            string Section;
            Section = null;
            for (int i = 0; i < Statya.Count; i++) {
                if (Section == Statya [i].Section) {
                    NameStatya.Add (Statya [i].ArticleTitle);
                } else {
                    NameStatya.Add (Statya [i].Section);
                    NameStatya.Add (Statya [i].ArticleTitle);
                    Section = Statya [i].Section;
                    SectionName.Add (Statya [i].Section);
                }

            }
            ArrayAdapter<String> adapter = new ArrayAdapter<string> (this, Resource.Layout.List_item, NameStatya);
            myListView.Adapter = adapter;
            myListView.ItemClick += MyListView_ItemClick;
        }