Android emulator camera custom image

AndroidImageAndroid EmulatorOverridingAndroid Camera

Android Problem Overview


Does anybody know is it possible to open some personal picture when emulator camera starts?

I have an application which is based on image analysis and I would like when I click a button for camera that camera opens not that default Android emulator moving image. I want it to open some image which I set as a default image. So when I choose to take a picture it will show only that image and when I take a take a picture, that image will be saved to gallery, not Android default image.

Android Solutions


Solution 1 - Android

Under Tools > AVD Manager, select the "pencil" to get to "Virtual Device Configuration". Show Advanced Settings > Camera will give you the option of using emulated, or a device:

> Device - use host computer webcam or built-in camera

Virtual Device Camera Configuration

If all you need is to get a still image into the camera, starting with Android Studio 3.2 you can put your static images into the virtual scene:

Virtual Scene Demo

as discussed in this entry from Android developers blog. Note that you'll need to move the camera position into the dining room to see your images (turn around and use Alt-w to move forward).

Solution 2 - Android

Finally!

  1. Append to file ~/Android/Sdk/emulator/resources/Toren1BD.posters
poster custom
size 2 2
position 0 0 -1.8
rotation 0 0 0
default custom.png
  1. Place 'custom.png' in ~/Android/Sdk/emulator/resources/
  2. Restart! emulator @Phone -no-snapshot -no-boot-anim (replace 'Phone' with the name of your avd! (see: emulator -list-avds)
  3. Profit!

Now you have a texture just in front of camera-default-position.

Solution 3 - Android

Update 2022

The best way use the OBS. this project creates a virtual webcam and you can play videos or show picture.

Step 1: Download the OBS Studio from this site and create a virtual webcam and add a video for plying that.

enter image description here

Step 2: Changing the config in android AVD. change front and back camera to webcom0.

enter image description here

Solution 4 - Android

It seems the only solution is to use a remote camera.

This is one way to do it: http://www.tomgibara.com/android/camera-source

It's not something what I was looking for but I think it can be used for testing. Maybe even barcode scanner would work with this if the barcode is placed properly in front of camera.

Solution 5 - Android

Download the source from following url . This is work as the another Gallery in the emulator. While passing intent to capture image from camera choose this gallery. this is looks like samsung mobile 3d gallery.. this will return the default images.. in emulators . one more thing it will work fine after 3.0 versions only.

https://github.com/c-jiang/Gallery3D-Mod

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCristianoView Question on Stackoverflow
Solution 1 - AndroidDaleView Answer on Stackoverflow
Solution 2 - AndroidRedCoreView Answer on Stackoverflow
Solution 3 - AndroidRasoul MiriView Answer on Stackoverflow
Solution 4 - AndroidCristianoView Answer on Stackoverflow
Solution 5 - Androiditsrajesh4uguysView Answer on Stackoverflow