samedi 17 février 2018

how to add items for listview with checkbox

I am new in android studio, I want view data from database using listview with checkbox. I found simple code from this link Listview with checkbox

I tried and i can't put data from database to code :

// Create and populate planets.  
planets = (Planet[]) getLastNonConfigurationInstance() ;  
if ( planets == null ) {  
  planets = new Planet[] {   
      new Planet("Mercury"), new Planet("Venus"), new Planet("Earth"),   
      new Planet("Mars"), new Planet("Jupiter"), new Planet("Saturn"),   
      new Planet("Uranus"), new Planet("Neptune"), new Planet("Ceres"),  
      new Planet("Pluto"), new Planet("Haumea"), new Planet("Makemake"),  
      new Planet("Eris")  
  };    
}  

I have tried using simple iteration like

for(int i=0;i<list_from_db.size();i++)
{ 
   new Planet(list_from_db.get(i));
}

May I get the help how to do this.




Aucun commentaire:

Enregistrer un commentaire