How to add button to start camera - java

I need some help adding a button, that will start the camera and then the captured image gets uploaded to my server.
the app already functions for browsing the gallery selecting a file adn uploading
I tried several answers from around the internet and none have worked.
The button is aded to the layout editor
I just need the code to start the camera

If you wish to start default camera app and just get the result when user navigates back, then i suggest to use camera intent with ACTION_IMAGE_CAPTURE: https://developer.android.com/training/camera/photobasics#TaskCaptureIntent

Related

How can I open a user's camera and have it open, but NOT to take a photo on Android Studio

I want to open the camera but not in photo form so I can add an overlay. I just need the camera to display what is shows but not to take the photo if that makes sense... How can I do this?
maybe this article help you open camera view in your app by creating your own view and open camera in its own different thread ,
as it might take time to load and this will result in the lagging UI.
Maybe this article from android developers website will help you achieve what you want.
https://developer.android.com/training/camera/cameradirect#kotlin

Android Capture current screen. not Activity

about android capture.
The function of the application is that when you press a specific button,
One overlay button located at the top of the home screen of the device is generated.
When I press the overlay button, I want to capture the screen of the device I'm currently viewing, not the application screen.
I want to capture the top screen, but only the activity done by the application is captured.
How should I capture the screen I'm currently viewing?
I tried researching this problem for days before but I do not think that it is possible. Then I have an idea that instead of try to screen shot "outside" of app, we can use Service to keep our app alive, make back ground transparent and detect screenshot action of device. You may want to try com.abangfadli.shotwatch

Display image full screen through Android adb

I would like a way to display an image in full screen mode (without the home and status bar showing, images are same resolution as the device) on an Android device through ADB. The image could be either on the device itself of on the computer I am using to adb to the device, if that makes a difference (my first thought was that the image would be on the computer, but I've found some answers that leverage the device's storage and that would be fine).
What I would eventually like to do is set up a script that displays an image in full screen and iterates to the next file on a keypress.
This answer might be useful, showing how to display an image, but it doesn't show the image in full screen mode.
Possible ideas I have had, but don't exactly know how to implement:
Create an app that displays an image full screen and launch it with the required image as a parameter (not sure how to link the picture and the app from adb though).
Use the -n parameter seen in this post and specify an app that only displays images in full screen (could maybe make this app, but a pre-made solution would be easiest).
Any help/advice/guidance would be appreciated.
What that command is doing is starting an Activity that claims it can VIEW jpgs and launching it (passing it the file name via intent). It is not a built in android functionality, its launching an app. For you to display fullscreen as you wish, you need an app that does that, either by default or when some optional parameter is passed. There is no app like that you can 100% count on being installed. SO if you really need it, you'll need to write an app that does it. It should be a pretty trivial app at least- 1 image view and a fullscreen style is all you need.

Android Camera Intent

I have a simple application that has a button that allows the user to enter the camera application by clicking it. It seems that things work fine if I were to take a picture having the tablet in landscape mode. It prompts the user to save or discard. After clicking save, it returns to my application.
However, when I attempted to capture a photo with a portrait mode, after clicking the save button, it will return to the camera application again.
Why is this so?
It has nothing to do with your application. By firing intent you are invoking camera application present on your device. Its behaviour out of your reach

Overlay VideoView but keep touch focus on underlying activities in Android

I'm trying to create an app that will display a video in a VideoView in a transparent activity but keep the touch focus on any underlying activity. For example, if I have one app opened and my app is launched, the video will show but the user can still interact with the app they were previously viewing. I have the transparent activity and video working but I can not find a way to keep interaction in the activity under mine. Please tell me if this is possible and how to do it. Thanks
Matt
Set WindowManager.FLAG_NOT_TOUCH_MODAL for your transparent VideoView Activity Window.
By doing this, it will by-pass the touch events on the area outside of your activity to the previous activity.

Categories