title: how to pass position of list item clicked using intent and use that data in my switch case function which shown in code
body: <p>list view item click and passing position using intent  </p>
  
  <pre><code>ListView lstview = (ListView) findViewById(R.id.listView);
      lstview.setAdapter(new CustomAdapter(this));
      lstview.setOnItemClickListener(new OnItemClickListener() {
  
          @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
          @Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,
                  long arg3) {
              // TODO Auto-generated method stub
  
  
              Bundle basket=new Bundle();
              basket.getInt("pos",position);
              Intent a= new Intent(Customlist.this,Customgrid.class);
              a.putExtras(basket);
              startActivity(a);
  
  
          }
      });
  </code></pre>
  
  <p>getting bundle data from previous activity and using  in switch block which is implemented inside getview method but it's not working properly..plz help..</p>
  
  <pre><code>public class Customgrid extends Activity {
  
  public Integer gotbread;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.customgview);
      Bundle gotbasket = getIntent().getExtras();
      gotbread = gotbasket.getInt("pos");
      GridView grdview = (GridView) findViewById(R.id.gridView);
      grdview.setAdapter(new Customgridadapter(this));
      grdview.setVerticalSpacing(5);
  }
  
  public class Customgridadapter extends BaseAdapter {
      public Integer[] images1 = { R.drawable.s_1, R.drawable.s_2,
              R.drawable.s_3 };
      public Integer[] images2 = { R.drawable.s_5, R.drawable.s_6,
              R.drawable.s_4 };
      Context m1Context;
  
      public Customgridadapter(Context context) {
          super();
          this.m1Context = context;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return images1.length;
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @SuppressLint("NewApi")
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          LayoutInflater inflater = ((Activity) m1Context)
                  .getLayoutInflater();
          View customRow1 = inflater.inflate(R.layout.gview, null);
          ImageView image = (ImageView) customRow1
                  .findViewById(R.id.imageforgrid);
         switch (gotbread) {
          case 0:
              image.setImageResource(images2[position]);
              break;
          case 1:
              image.setImageResource(images1[position]);
              break;
          }
          image.setAdjustViewBounds(true);
          image.setScaleX((float) 0.5);
          image.setScaleY((float) 0.5);
          return customRow1;
      }
  };
  </code></pre>
  
  <p>}</p>