android - ArrayList<Model> showing wrong values -


I have created a database that stores the details of the group. I want to show the details of that group in a list view But when I open my open app only see the last value in the database. Why is this happening P>

Getting value from the database

  Public AERLIT < GroupModel & gt; GetAllGroups () {SQLite database database = getWritableDatabase (); String query = "select + to" + tableName; GroupModel GroupModel; Cursor c = database.rawQuery (query, empty); While (c.moveToNext ()) {getGroupInfo = new ArrayList & lt; GroupModel & gt; (); GroupModel = new groupModel (C.GetString (C.GetolmindXORTRO (GroupName)), C.GetString (C.Calgunum IndexesAuthor (created)); GetGroupInfo.add (groupModel); } Return getGroupInfo; }  

When I debug my

  first recurrence list value [0] = "A", "B" 2 recovery list value [0] = "Pq";  

Why this is happening, should have the desired result

  First run inventory value [0] = "A", "b" second walking list value [1] "p", "q" =;  

Model class

  Public class group modell {Private string group id, group name, group credit date, contact command, contact name, contact number; Public GroupModel () {} Public Group Model (string group name, string group creative) {this.groupName = groupName; This.groupCreatedDate = groupCreatedDate; } Public group model (string group id, string contact id, string contact name, string contact number) {this.groupId = groupId; This.contactId = contactId; This.contactName = Contact Name; This.contactNumber = Contact Number; } Public string getGroupId () {return groupId; } Public Zero Set Group IID (String Group ID) {this.groupId = groupId; } Public string getGroupName () {return groupName; } Public Zero setGroupName (string group name) {this.groupName = groupName; } Public string getGroupCreatedDate () {return groupCreatedDate; } Public Zero Set Group Content Date (String Group Created Date) {this.groupCreatedDate = groupCreatedDate; } Public string getContactId () {contact with return; } Public ZeroSetSearchIight (string contactAudio) {this.contactId = contactId; } Public string getContactName () {contactName; } Public Zero Set CONTEXTNET (string contact name) {this.contactName = contactName; } Public string getContactNumber () {return contact number; } Public Zero Sat Communication Number (String Contact Number) {this.contactNumber = Contact Number; }}  

there

  while (c. Transfer ()) {getGroupInfo = New Arrestist & lt; GroupsModel & gt; (); GroupModel = new groupModel (C.GetString (C.GetolmindXORTRO (GroupName)), C.GetString (C.Calgunum Indexesorthro (Created)); GetGroupInfo.add (groupModel); }  

You are starting the array list every time you need to start the array list before and after the time of the loop.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -