protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //set the layout to a list view SetContentView(Resource.Layout.PlantListView); //find the list view and make an object ListView listView = new ListView(this); data = Intent.GetStringExtra("plantFilePath") ?? "Data not available"; using (var streamReader = new StreamReader(data)) { //reads the file and then sets it to a string string content = streamReader.ReadToEnd(); //get the list out of the file plantList = JsonConvert.DeserializeObject <PlantList>(content); } //and then put each item in the list class instance into a listview thing PlantAdapter plantAdapter = new PlantAdapter(this, plantList); ListView.Adapter = plantAdapter; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //set the layout to a list view SetContentView(Resource.Layout.PlantListView); //find the list view and make an object ListView listView = new ListView(this); dataNew = Intent.GetStringExtra("plantFilePath") ?? "No data file"; if (data != dataNew) { data = dataNew; } //call the method for streamreader to deserialize json plantList = Get_File(data); //and then put each item in the list class instance into a listview thing PlantAdapter plantAdapter = new PlantAdapter(this, plantList); ListView.Adapter = plantAdapter; ListView.ItemClick += ListView_ItemClick; }