title: Android - Open selected picture in Action view?
body: <p>In my app i got a galleryview. All the pictures are thumpsnails, and i want to open the picture in some kind of action view when it's selected.</p>
  
  <p>But i can't seem to find out quite how. Can any one help?</p>
  
  <p>EDIT:
  My gallery is not loaded from the SD card. It's generated with pictures from the resource dir inside the app.</p>
  
  <p>My code:</p>
  
  <pre><code>import dk.appsfabrikken.iphonetabs.R;
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.content.res.Configuration;
  import android.content.res.TypedArray;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.View.OnClickListener;
  import android.widget.AdapterView;
  import android.widget.BaseAdapter;
  import android.widget.Button;
  import android.widget.Gallery;
  import android.widget.ImageView;
  import android.widget.AdapterView.OnItemClickListener;
  
  public class CombarActivity extends Activity {
      private Gallery gallery;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.combar);
  
          //Knapper instantieres
          Button butMarked = (Button)findViewById(R.id.btmarket);
  
          //Opretter on click listerner til enkelt klik
          butMarked.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
              onclick_btmarket();
  
              }
          });
  
          //Gallery findes på layout
          gallery = (Gallery) findViewById(R.id.gallery1);
          gallery.setAdapter(new AddImgAdp(this));
  
          //Onlick listerner oprettes
          gallery.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
          }
          });
  
          }
  
          public class AddImgAdp extends BaseAdapter {
          int GalItemBg;
          private Context cont;
  
          // Tilføjer billeder til gallery
          private Integer[] Imgid = {
          R.drawable.combar2, R.drawable.combar1};
  
          public AddImgAdp(Context c) {
          cont = c;
          TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme);
          GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
          typArray.recycle();
          }
  
          public int getCount() {
          return Imgid.length;
          }
  
          public Object getItem(int position) {
          return position;
          }
  
          public long getItemId(int position) {
          return position;
          }
  
          public View getView(int position, View convertView, ViewGroup parent) {
          ImageView imgView = new ImageView(cont);
  
          imgView.setImageResource(Imgid[position]);
          // Tilpasser højde og bredde for billeder i gallery. Tester skærmstørrelse og tilpasser.
          if ((getResources().getConfiguration().screenLayout &amp;      Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
              imgView.setLayoutParams(new Gallery.LayoutParams(110, 170));
          }
          else{
          imgView.setLayoutParams(new Gallery.LayoutParams(220, 340));
          }
          imgView.setScaleType(ImageView.ScaleType.FIT_XY);
          imgView.setBackgroundResource(GalItemBg);
  
          return imgView;
          }
          }
          //Udfører opgave for click på knap
          private void onclick_btmarket() {
              Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://market.android.com/details?id=dk4.ef.cms"));
              startActivity(browserIntent);}
  
              ;
  
          }
  </code></pre>
  
  <p>Thanx in advance.</p>