Dynamic add items to listview using arrayadapter Android


Im using Custom class to fill Adapter on ListView Class looks like that:

package com.example.raidplanner; public class RaidWpis { private int id; private int id_gildia; private String nazwa; private int schemat; private int data_zapis; private int data_start; private int opis; private int id_officer; private int nick_officer; private int typ; public RaidWpis(int id,String nazwa) { setNazwa(nazwa); setId(id); } public int getId(){ return id; } public void setId(int id){ this.id = id; } public String getNazwa() { return nazwa;} public void setNazwa(String nazwa) { this.nazwa = nazwa; } public String toString() { return this.nazwa; } public String toString2() { return this.id+" - "+nazwa; } }

In my activity Im using this code

RaidWpis[] items = { new RaidWpis(1, "aaaa"), new RaidWpis(3, "bbbb"), new RaidWpis(6, "cccc"), new RaidWpis(11, "dddd"), new RaidWpis(17, "eeee"), }; mainListView = (ListView) findViewById( R.id.mainListView ); ArrayAdapter<RaidWpis> raidList = new ArrayAdapter<RaidWpis>(this, R.layout.simplerow, items); // Create ArrayAdapter using the raid list. mainListView.setAdapter(raidList);

Now how to add new items to items array. Finaly I want to fill that items array with data from json data (passed from PHP)


I did it, just changed some code to that:

ArrayList<RaidWpis> raid_list = new ArrayList<RaidWpis>(); raid_list.add(new RaidWpis(1, "aaaa")); raid_list.add(new RaidWpis(3, "bbb")); raid_list.add(new RaidWpis(5, "ccc")); ArrayAdapter<RaidWpis> raidList=new ArrayAdapter<RaidWpis>(this, R.layout.simplerow, raid_list);


  • Loading animation while passing between scenes
  • Multi-Filterable Table with JS
  • Is it better to use ob_get_contents() or $text .= 'test';
  • What type of password I have to give to set the custom account for application pool identity
  • MVC Controller Action only receiving nulls from AJAX
  • openssl_encrypt & AES256
  • ARKit 2 - Crop Recognizing Images
  • Attempting to generate Pascal's Triangle as a tuple using recursion
  • How to check if an object exist in python
  • Spark multiple dataframe saves
  • Jigsaw Puzzle Solver Method
  • Guava: How does Cacheloader.load() work
  • Rails Nested attributes with check_box loop
  • CSS slide bottom border on click
  • Angular2 Renderer setElementStyle is not working
  • Difficulties using Variadic Templates
  • PHP: Text Processing preg_match function
  • In C++ how to best decouple 2 classes that must maintain collections of references to each other
  • Activity has leaked window while using volley
  • What are the precautions to be taken while creating a clearcase component?
  • Metro Flyouts with MVVM
  • PhoneStateListener memory leak - android
  • How to use vowpal wabbit for online prediction (streaming mode)
  • Calling MySQL Stored Procedure on PHP
  • Jaccard Similarity of an RDD with the help of Spark and Scala without Cartesian?
  • Entity Framework: “Faking” a queryable navigation property
  • Unpacking zip files in Java that cause a “java.util.zip.ZipException” - invalid LOC header (bad sign
  • search the database based on the value selected from database
  • JS showModalDialog not working in chrome as modal
  • Determine Active Panel
  • How to include WYSIWYG text editor in an HTML using google script
  • JavaMail connection problems [duplicate]
  • Google App Engine Datastore: Dealing with eventual consistency
  • How to get rgb from transparent pixel in js
  • Bitrate JWplayer