How to put camera sensor inside my Activity? [duplicate] - java

This question already has an answer here:
Custom camera android
(1 answer)
Closed 8 years ago.
There is an application made by another developer and I need to continue it. It has an activity with a button that calls the default camera app as an intent with startActivityForResult. It works ok when they take only one picture per app session. But now the client wants to be able to take various photos from different position of the place and then upload them all to the web server. So I need another way to do that, faster than opening the camera app for every picture.
For this I wish to load the camera directly in my activity, place a 'shoot' button, a label with the number of pictures taken, an imageView with the last image saved, and a button to finish. As an example I show you this printed screen from Internet.
The idea is to save a picture on every button click, and save the file names in an array.
How can I use the camera this way and control it with a custom button?

I also try to control the camera and I am using this link
I hope it is useful for you. It has helped me to fix several bugs

Related

Android Studio, making a text based game

My first android app I'm creating, a text based game. Everything is looking great so far with functionality. I'm just wondering 2 things, one, is there a way to control how the new activity opens in the screen (new activities open from the center of the screen on my app, takes about a half second), and second, its it better to have each button pressed choice open a new activity or is there a better way to clear the screen and use the if and else commands in java.
I think as for the first part, you may want to use animation on transition between activities/fragments.
You do want to read more about fragments as i think it will solve your second question.
Check this small tutorial for the animation part.
Check docs for fragments.
Good luck.

Camera in a frame

i need to know if there is a possibility to put a camera (with ACTION_IMAGE_CAPTURE) in a Activity splitted in two part , in the top the camera , and in a buttom part a listview of the captured images.
I'm sorry if this question is simple or stupid, but i'm new in the Android programming.
Thx Alessandro
As far as I understand you are trying to launch the external camera app with a intent, using ACTION_IMAGE_CAPTURE.
So, no its not possible to style/modify another activity/app.

Android application design help, How to control which activity shows

Hello I require some advice on how to approach this problem,
bear with me as I am still new to android.
I have an activity that opens on application start and requires some information from the user, but next time the user opens the app, i want the application to open a different activity that will display the various information.
Kind of like facebooks app, where when you first run it, you have to login, and only then next time you run the app you are guided straight to the feed.
Any ideas how one could do this efficiently?
UPDATE: Ive stored the information via shared preferences and am now using a controller activity that decides which step to take.
So, Controller activity runs on start up, and decides whether to show a log in screen or whether to go straight to the information. But now im encountering a problem where i end up opening a blank activity (the controller) and then another ontop of that ( the decided activtiy). I dont want the blank activity to show, so its kinda of like a background process, any ideas?
Ideally you would have a main activity like a controller. Use a SharedPreference object to keep track of whether the user is logged in or not. So back in your main activity, read this value and if it is set go to your news feed activity else show a login screen activity. (as you do the check and redirection, you can show a progress dialog)
links for SharedPreferences
MobTuts
Android Developer

View different images depending on what item in my list view I click

I'm fairly new to Android programming and I've got this project I need to finish and I'm currently stuck.
I've got a standard listview in a Menu class with an array containing around 20 different elements. So what I want to do is load images in an imageview depending on which item in the listview I click, and since I'm a beginner the only idea I had was to make a new activity for each imageview which seems like a pretty bad way to do it since I'd need about 20-30 new activities..
To sum things up what I want is:
Code for making ONE activity that will display a different image depending on which item in the listview I click, probably pretty basic coding I want as simple solution as possible.
If possible I'm also looking for a solution that includes an SQLite database that stores the URL of an image and then display it in a single activity, also depending on which item I press in my current listview.
(I hope you understand my needs, and if you need I can also post my current code for the Menu class if it helps you help me) Or you can just show me a different way to make this work, I appreciate every answer! Thanks in advance!
NOTE
And please keep in mind, I'm a noob at Java and Android so keep it rather simple or at least explain what you do.
When you click on a list item, display the image in another view in the same layout, unless you want the image to take up the entire screen real estate. If you want it in the entire screen, go to a new Activity by sending the activity an Intent.
Activities are the "controller" of your application. They interact with the visible UI and the input from the user. You don't need a separate activity for each image, just an activity that's associated with a "place" in the UI (an ImageView) where you'll display the image.
I'd start by adding the images as resources under res/drawable before going on to databases.
You are going to have to do most of this yourself. There really isn't any substitute for taking the time to learn Java and Android. There are several tutorials and Android University classes under the Resources tab in the Developers Guide; I suggest you do all of them.

Take picture automatically with MediaStore Intent

What I am looking to do is to capture an image on a button click, without requesting any other input from the user.
At the moment I'm using a MediaStore.ACTION_IMAGE_CAPTURE intent inside my activity, which is called when pressing a button on a widget. At the moment this opens the camera preview allowing me to take a picture.
That's all working great, however what I'm looking to do is when the user presses the button on the widget, take the picture straight away and display a preview of the captured image. So it essentially snaps the picture automatically, without the need for the user to press anything else.
I tried using the Camera API directly, using a SurfaceView class to capture the image and call the PictureCallback etc, this worked how I want it to, however the quality of the images was very low and I couldn't figure out how to change it.
So I guess I'm looking for an answer to either of those two problems, or both if anyone knows them.
Firstly, is there anyway, using something similar to a MediaStore.ACTION_IMAGE_CAPTURE intent to snap the image automatically without requesting the user to take the picture.
Or secondly, how can I increase the quality and resolution of an image captured using the Camera API directly (camera.takePicture(shutterCallback, rawCallback, jpegCallback); and all that business).
Any help would be much appreciated.
Did you try autoFocus?

Categories