title: how can i change layout using onListItemClick() in Android?
body: <p>I try to to change the <strong>layout</strong> by clicking my <code>ListView</code>.</p>
  
  <p><strong>This is my Java class.</strong></p>
  
  <p>I have an <code>ArrayList</code> of <em>bus_routes</em></p>
  
  <pre><code>public class Main extends ListActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      setListAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1 ,
              getResources().getStringArray(R.array.bus_routes)));
  }
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      // TODO Auto-generated method stub
      super.onListItemClick(l, v, position, id);
  
      Intent intent = new Intent(Main.this, Second.class);
      startActivity(intent);
  }
  </code></pre>
  
  <p><strong>Manifest</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="listview.com"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="21" /&gt;                             &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".Main"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                 &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Second"
              android:label="@string/title_activity_second" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Array List</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;resources&gt;
          &lt;string-array name="bus_routes"&gt;
              &lt;item&gt;100 Pettah to Panadura&lt;/item&gt;
              &lt;item&gt;101 Pettah to Moratuwa&lt;/item&gt;
              &lt;item&gt;102 Kotahena to Moratuwa&lt;/item&gt;
              &lt;item&gt;103 Fort to Borella&lt;/item&gt;
              &lt;item&gt;104 Bambalapitya to Wattala&lt;/item&gt;
              &lt;item&gt;107 Fort to Elakanda&lt;/item&gt;
          &lt;/string-array&gt;
      &lt;/resources&gt;
  </code></pre>