title: Android:navigation by clicking item on listview and retrieve data frm database and show it in another listview
body: <p>I have a listview retrieved from the database </p>
  
  <pre><code> public class DiseaseList extends ListActivity{
  
  
  DataHelper dh;
  
  
  
  @Override   
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.diseaselist);
  
      dh = new DataHelper(this);
      dh.open();
      dh.getAllDiseaseNames();
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1);
  
      setListAdapter(adapter);
  
  }
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      // TODO Auto-generated method stub
      super.onListItemClick(l, v, position, id);
  
      String item=(String)getListAdapter().getItem(position);
  
  
      if(item.equals("Pain")){
          dh.getSymptomsByDiseaseId(1);   
          startActivity(new Intent(DiseaseList.this,Symptoms.class));
              }
              else if(item.equals("Color change in teeth")){
                  dh.getSymptomsByDiseaseId(2);
                  startActivity(new Intent(DiseaseList.this,Symptoms.class));
              }
              else if(item.equals("bleeding gums")){
                  startActivity(new Intent(DiseaseList.this,Questions.class));
              }
              else if(item.equals("decay in teeth")){
                  startActivity(new Intent(DiseaseList.this,Questions.class));
              }
              else if(item.equals("dislodged caps")){
                  startActivity(new Intent(DiseaseList.this,Questions.class));
              }
              }
                }
  </code></pre>
  
  <p>and my datahelper class methods to retrieve this data are :</p>
  
  <pre><code> public List&lt;String&gt; getAllDiseaseNames() {
           List&lt;String&gt; diseasename = null;
  
           cr = db.query(DISEASE_TABLE_NAME,new String[] {DISEASE_NAME}, null, null, null, null, null);
  
              if(null != cr){
                    diseasename = new ArrayList&lt;String&gt;();
                    if (cr.moveToFirst()) {
                       do {
                          diseasename.add(cr.getString(0));
                       }  while (cr.moveToNext());
                    }
  
                    if (cr != null &amp;&amp; !cr.isClosed()) {
                        cr.close();
                    }
                }
                return diseasename;
             } 
  
  
       //symptomsbydiseaseid to get symptoms in list view
  
       public List&lt;String&gt; getSymptomsByDiseaseId(long diseaseId) {
  
              List&lt;String&gt; symptomsList = new ArrayList&lt;String&gt;();
  
              String selection = "diseaseid=?";
              String[] selectionArgs = { String.valueOf(diseaseId) };
              cr = db.query(false, SYMPTOM_TABLE_NAME, null, selection, selectionArgs, null, null, null, null);
              if (cr.moveToFirst()) {
                  do {
                      symptomsList.add(cr.getString(0));
                  } while (cr.moveToNext());
              }
              cr.close();
  
              return symptomsList;
          }
  </code></pre>
  
  <p>Now in the first listview, when I click on "A" , I should move to another listactivity and display another listview under category A and same with B and C and D... and under the anther listview, it will have another list of questions to be asked on clicking them </p>
  
  <p>My symptomclass is as follows: </p>
  
  <pre><code>package com.dentabtechnologies.appstart;
  
  import com.example.dentabtechnologies.R;
  
  import android.app.ListActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class Symptoms extends ListActivity {
  
          @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.symptoms);
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1);
  
      setListAdapter(adapter);
  
  }
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      // TODO Auto-generated method stub
      super.onListItemClick(l, v, position, id);
  }   
  
  } 
  </code></pre>
  
  <p>How can i achieve this? 
  Thank you </p>
  
  <p>the flow is from Disease listview > Symptom listview > Subsymptom listview > and questions in different text views </p>