RICOH THETA Plug-in: How To Get Last Picture Taken with HTTP

This example shows the following:

  1. get URI of last picture taken from plug-in using the library theta4j
  2. show URI on logs

For people who want to go further this example also shows:

  1. display last image take in Vysor using the Glide library to help with testing
  2. control image display with Wi-Fi button press
  3. convert URI to image file path to directly access image file on ExternalStorage sdcard


  • You can use theta4j to take a picture
  • You’re able to use the pluginlibrary for button presses
  • You can edit the Gradle files to implement the libraries above
  • You can edit AndroidManifest.xml to adjust properties

If you have problems with the two points above, you can either go through these drills from @jcasman or copy and paste the starter code below or clone the entire repo, master branch.

I am using Glide and ImageView to help with testing. For your plug-in development, you should take the URI and feed it into your application. If you prefer, you can also parse the URI and use the last portion to access ExternalStorage directly.


  1. Under MainActivity, create variable of type URL.

     URL url;
  2. under executor.submit and above the try statement to take a picture, add

    CommandResponse<TakePicture.Result> response = null;
  3. assign response to `theta.takePicture();

     response = theta.takePicture();
  4. implement while loop to wait for takePicture() to finish

Place below the last catch for takePicture()


                while (response.getState() != CommandState.DONE) {
                    try {
                        response = theta.commandStatus(response);


                    } catch (IOException e) {
                    } catch (InterruptedException e) {
  1. assign url to the result of the response. Put this at the end of the while loop (outside of the loop)

     url = response.getResult().getFileUrl();
  2. Print the url out to your log

    Log.d("THETADEBUG", "fileUrl: " + url);

Congratulations, you’re done

Optional – Display Image to Vysor Screen

For testing purposes, you can display the image and URI to the virtual THETA screen using Vysor.

  1. Create ImageView to activity_main.xml

Click on the text ImageView in the left panel. Drag it onto the graphical screen on the right. If ImageView is not visible, search for it.

  1. Assign id of ImageViewId


  1. Create ImageView variable in

  1. Add Glide to Gradle and sync

     implementation 'com.github.bumptech.glide:glide:4.9.0'
     annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
  2. Create method showImage


  1. attach imageView to resource ID in layout file


  1. Show Image on Key Up


  1. display URL on screen with Toast


Get Image File Path

  1. create new method for getImagePath()


  1. call method from onKeyUp


  1. Test
    Take picture and check logcat

  1. Add Toast

     return filepath;

Code Listing

The code is in the response-vysor branch