• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Grid View with Videos

kivy

Newbie
Jul 13, 2010
17
0
Hi there,

I got a question because I am at the moment stuck. I put some videos on my emulator SD card and would like to access them via the GridView and when you click on a video, a menu should open. How could I do that? Would be great if someone could help me out here...

Thanks.

---------
What I mean is: based on this code from the Grid View Tut, what would I need to change to display videos from the SD card:

Code:
public class EditGalleryView extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.videogrid);
        
        GridView vGrid=(GridView) findViewById(R.id.vgrid);
        vGrid.setAdapter(new VideoAdapter(this));
    }
    
    public class VideoAdapter extends BaseAdapter {
    	private Context mContext;
    	
		public VideoAdapter(Context c) {
		    mContext = c;
	    }

	    public int getCount() {
	        return mThumbIds.length;
	    }

	    public Object getItem(int position) {
	        return null;
	    }

	    public long getItemId(int position) {
	        return 0;
	    }

	    // create a new ImageView for each item referenced by the Adapter
	    public View getView(int position, View convertView, ViewGroup parent) {
	        ImageView imageView;
	        if (convertView == null) {  // if it's not recycled, initialize some attributes
	            imageView = new ImageView(mContext);
	            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
	            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
	            imageView.setPadding(8, 8, 8, 8);
	        } else {
	            imageView = (ImageView) convertView;
	        }

	        imageView.setImageResource(mThumbIds[position]);
	        return imageView;
	    }

	    // references to our images
	    private Integer[] mThumbIds = {
	            R.drawable.sample_2, R.drawable.sample_3,
	            R.drawable.sample_4, R.drawable.sample_2,
	            R.drawable.sample_6, R.drawable.sample_3,
	            R.drawable.sample_4, R.drawable.sample_1,
	            
	    };
    	
    }
    
  
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones