Search code examples
androidandroid-gallery

Select video from gallery, cannot find symbol RESULT_LOAD_IMAGE


Select video from gallery

I am trying the following code to get a video from my phone's gallery:

Intent mediaChooser = new Intent(Intent.ACTION_GET_CONTENT);
mediaChooser.setType("video/*, images/*");
startActivityForResult(mediaChooser, RESULT_LOAD_IMAGE);

My problem is that I am getting an error saying that it can't resolve the symbol "RESULT_LOAD_IMAGE" Any thoughts? Possible entry to the manifest file?


Solution

  • you need to define a global variable just after class declaration like this

    private static int RESULT_LOAD_IMAGE = 1;
    

    Also the above method works for ICS or bigger.