title: expandable list to get data from an sqlite db using a hashmap for both header and children bt returns one parent and its children only
body: <p>I am trying to retrieve all parents and children but I end up getting one parent and all its children what could be the problem? </p>
  
  <p>The first cursor gets the artist name the after getting the artist name I use it to get the title of all songs sung by the artist on another table in the database and the add all the children to the String list and add the items to a hashmap the move to the next artist but it returns all artist details.</p>
  
  <p>How can I retrieve all artist and all children in such an example 
  anybody help please?</p>
  
  <pre><code>Cursor rs=db.viewArtist();
  if(rs.getCount()&gt;0) {
      while (rs.moveToNext()) {
          headerL = new ArrayList&lt;&gt;();
          String header = rs.getString(0);
          headerL.add(header);
          Cursor xl = db.viewtittle(header);
          xl.isFirst();
  
          Toast.makeText(getActivity(),""+header,Toast.LENGTH_LONG).show();
              my_child = new ArrayList&lt;&gt;();
              while (xl.moveToNext()) {
                  my_child.add(xl.getString(1));
                  map = new HashMap&lt;&gt;();
                  Toast.makeText(getActivity(),""+xl.getString(1),Toast.LENGTH_LONG).show();
              }
              map.put(header, my_child);
          }
         for (int i=0;i&lt;map.size();i++){
             Toast.makeText(getActivity(),"value"+map.entrySet(),Toast.LENGTH_LONG).show();
         }
          adapter=new ExpandableListAdapter(view.getContext(),headerL,map);
          rs.close();
  
  myView= (ExpandableListView) view.findViewById(R.id.songs_list);
  </code></pre>
  
  <p>Here is my database  helper code</p>
  
  <pre><code>public Cursor viewAllText(){
          SQLiteDatabase db=getWritableDatabase();
          Cursor rs=db.rawQuery("select * from quotes ORDER BY RANDOM() LIMIT 1",null);
          return rs;
      }
  
      public Cursor viewArtist(){
          SQLiteDatabase db=getWritableDatabase();
          Cursor rs=db.rawQuery("select * from artist",null);
          return rs;
      }
      public Boolean insertArtistData(String artist){
          SQLiteDatabase db=getWritableDatabase();
          ContentValues values=new ContentValues();
          values.put(COL_NAME, artist);
          long insert=db.insert(tableSinger,null,values);
          if(insert==-1)
              return false;
          else
              return true;
      }
  
      public Boolean insertSongData(String tittle, String artistis, String lyrics) {
          SQLiteDatabase db=getWritableDatabase();
          ContentValues values=new ContentValues();
          values.put(COL_F_NAME, artistis);
          values.put(COL_LYRICS,lyrics);
          values.put(COL_TITTLE,tittle);
          long insert=db.insert(tableSongs,null,values);
          if(insert==-1)
              return false;
          else
              return true;
  
      }
  
      public Cursor viewtittle(String header) {
          SQLiteDatabase db=getWritableDatabase();
          Cursor rs=db.rawQuery(" SELECT * FROM songs WHERE artist_f_name = '"+header+"' ",null);
          return rs;
      }
  </code></pre>