title: Using a ListView to Switch to Different Activities
body: <p>I have a Button on My Main Activity called Colours, it takes the user to a new activity with a ListView of Colours(Blue, Red, Yellow etc). On the Colours Activity I used a ListView and populated the entries using a string array xml. Problem is I do not know the code to write so I can select Colour Blue and be taken to a new activity called Blue or select Colour Red to switch to Red Activity etc.</p>
  
  <p>Here's my sample, List.java</p>
  
  <pre><code>            package ng.com.degee;
  
                  import android.app.Activity;
                  import android.os.Bundle;
  
  
                  public class List extends Activity {
  
                      @Override
                      protected void onCreate(Bundle savedInstanceState) {
  
                          super.onCreate(savedInstanceState);
                          setContentView(R.layout.colourslist);
  
  
                      }
  
  
                  }
  `
  </code></pre>
  
  <p>Here's colourslist.xml</p>
  
  <pre><code>                `&lt;?xml version="1.0" encoding="utf-8"?&gt;
                  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical" &gt;
  
                      &lt;ListView
                          android:id="@+id/ColoursListView"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:entries="@array/list_data" &gt;
  
                      &lt;/ListView&gt;
  
                  &lt;/LinearLayout&gt;`
  </code></pre>