Code example for Gallery

Methods: getAdapter

0
        mGallery.setOnItemClickListener(new OnItemClickListener() {
 
            @Override 
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Gallery gallery = (Gallery)parent;
                if (position + 1 == gallery.getAdapter().getCount()) {
                    startCaptureImage(); 
                } 
            } 
             
        }); 
 
    } 
 
    private void startCaptureImage() { 
        Intent it = new Intent();
        it.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(it, REQUEST_CODE_IMAGE_CAPTURE);
    } 
 
    @Override