title: New activity when click on ListView
body: <p>I treat XML and deduce which category parent_id = 0. Each line in the list has a unique id. How to display the list of strings that Activity belong to this line? (eg string has id = 1. When you click on this line you want to display a string in which the parent_id = 1). Need to use the new Activity or can use CatalogActivity.java?<br></p>
  
  <p><strong>CatalogActivity.java</strong></p>
  
  <pre><code>public class CatalogActivity extends ListActivity {
  private ProgressDialog pDialog;
  static final String URL = "https://api.api2cart.com/v1.0/category.list.xml?api_key=6aed775211e8c3d556db063d12125d2d&amp;store_key=ed58a22dfecb405a50ea3ea56979360d&amp;start=0&amp;count=38&amp;params=id,name,parent_id,images";
  
      static final String KEY_ITEM = "category";
      static final String KEY_ID = "id";
      static final String KEY_PARENT_ID = "parent_id";
      static final String KEY_TITLE = "name";&lt;br&gt;
      static final String KEY_THUMB_URL = "http_path";
      String Parend_id;
      int id_parent;
      ListView list;
      LazyAdapter adapter;
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; catalogList;
  
      //@Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          catalogList= new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
          new LoadCatalog().execute();
      }
  
          class LoadCatalog extends AsyncTask&lt;String, String, String&gt;   {
  
               @Override
                  protected void onPreExecute() {
                      super.onPreExecute();
                      pDialog = new ProgressDialog(CatalogActivity.this);
                      pDialog.setMessage("Загрузка каталога ...");
                      pDialog.setIndeterminate(false);
                      pDialog.setCancelable(false);
                      pDialog.show();
                  }
  
               protected String doInBackground(String... args) {
                   XMLParser parser = new XMLParser();
                      String xml = parser.getXmlFromUrl(URL); // getting XML from URL
                      Document doc = parser.getDomElement(xml); // getting DOM element
  
                      NodeList nl = doc.getElementsByTagName(KEY_ITEM);
                      // looping through all song nodes &amp;lt;song&amp;gt;
  
                      for (int i = 0; i &lt; nl.getLength(); i++) {
  
                          // creating new HashMap
                          //HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
                          Element e = (Element) nl.item(i);
                          Parend_id=parser.getValue(e, KEY_PARENT_ID);                        
                          if(Parend_id.equals("0")) { 
                              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); 
                              map.put(KEY_ID, parser.getValue(e, KEY_ID)); 
                              map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
                              map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL)); 
                              catalogList.add(map); 
                              }
  
  
                      }
                      return null;
  
               }
  
  
               protected void onPostExecute(String file_url) {
                      // dismiss the dialog after getting all products
                      pDialog.dismiss();
                      // updating UI from Background Thread
                      runOnUiThread(new Runnable() {
                          public void run() {
                              list=getListView();
                              adapter=new LazyAdapter(CatalogActivity.this, catalogList);
                              list.setAdapter(adapter);
                          }
                      });
  
  
         // list=(ListView)findViewById(R.id,list);
  
  
          // Getting adapter by passing xml data ArrayList
  
  
          // Click event for single list row
          list.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
                  Intent showInfo = new Intent(getApplicationContext(), CatalogActivity.class);
                  startActivity(showInfo);
  
              }
          });
      }
  
  }
  }
  </code></pre>
  
  <p><a href="http://s017.radikal.ru/i438/1312/93/17c7c4df5bcf.png" rel="nofollow">example XML file</a> (XML rendered as a PNG)</p>
  
  <p>When I click on Components in ListView put Mac as id Components = parent_id Mac</p>