title: How can i --"Start Intent by GridView item Click" (not image)
body: <p>I want to start every Intent that remains under my <code>src</code>. They are named as <code>One.java</code>, <code>Two.java</code> and so on.</p>
  
  <p>Here is my java code, but after clicking on a GridView item, it is opening the same Intent window, not the <code>One.java</code> or <code>Two.java</code> activity.</p>
  
  <ul>
  <li><p>MyActivity.java:</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.GridView;
  public class MyActivity extends Activity {  
  
  static final String[] numbers = new String[] { "One", "Two", "Three", "Four", "Five", "Six",  "Seven"  };
  
  @Override
      public void onCreate(Bundle savedInstanceState) {      
          super.onCreate(savedInstanceState);
          setContentView(R.layout.myactivity);
  
          GridView gv = (GridView) findViewById(R.id.gridView1);
  
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, numbers);
  
          gv.setAdapter(adapter);
          gv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v,int position, long id) {
                  Intent i = new Intent(getApplicationContext(), MyActivity.class);
                  i.putExtra("id", position);
                  startActivity(i);
              }
          });
      }
  }
  </code></pre></li>
  </ul>
  
  <p>This will help:</p>
  
  <p><a href="http://www.mkyong.com/android/android-gridview-example/" rel="nofollow noreferrer">http://www.mkyong.com/android/android-gridview-example/</a> and</p>
  
  <p><a href="https://stackoverflow.com/questions/6024374/android-gridview-need-to-open-different-intents?rq=1">Android Gridview - Need to open different intents</a></p>