1

My application filmed a video and then back to a screen that allows me to choose another video or gallery display videos. The problem is that the gallery does not display all the videos I record, just one. I'm sure I record the videos because they appear in My Files.

The code used to display the gallery is as follows:

final static int REQUEST_VIDEO_CAPTURED = 1;
    private Uri uriVideo;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.video_list);

        Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
        intent.setType("video/*");
        startActivityForResult(intent, 1);

            //I also try this
        // Intent intent = new Intent(Intent.ACTION_PICK,
        // android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        // intent.setType("video/*");
        // startActivityForResult(intent, 1);

            // and this
        // Intent intent = new Intent();
        // intent.setType("video/*");
        // intent.setAction(Intent.ACTION_GET_CONTENT);
        // startActivityForResult(Intent.createChooser(intent, "Select Video"),
        // 1);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == REQUEST_VIDEO_CAPTURED) {
                uriVideo = data.getData();
                Toast.makeText(VideoList.this, uriVideo.getPath(), Toast.LENGTH_LONG).show();

                ContentResolver res = getApplicationContext().getContentResolver();
                Cursor cursor = MediaStore.Video.query(res, data.getData(), new String[] { MediaStore.Video.VideoColumns.DURATION });
                if (cursor.moveToFirst()) {
                    duration = cursor.getString(0);
                }

                if (uriVideo != null) {

                }
            }
        } else if (resultCode == RESULT_CANCELED) {
            uriVideo = null;
            finish();
        }
    }

I hope you understand, it's my first question.

Thank you very much! Sorry for my bad English

SolArabehety
  • 8,467
  • 5
  • 38
  • 42
  • Check this [answer](http://stackoverflow.com/questions/9414955/trigger-mediascanner-on-specific-path-folder-how-to/9430065#9430065) – bluefalcon Jul 24 '12 at 17:14

1 Answers1

0

you must request the system to update the media gallery