Android Studio - ImageView with CameraRoll or Camera - java

I just started with Android Studio and I'm sure this question was maybe asked but:
I have a small app with an ImageView in the center.
Below, I have 2 buttons. All I want is this:
When one button is touched, I want the camera roll to appear, so when a photo is selected, the photo is placed inside the ImageView.
When the other button is touched, I want the user to take a photo and the photo needs to appear in the imageView.
Is there a tutorial on this specific issue?
Mirza

Related

How to turn it off the snap button and ok button in camera by android studio?

I currently require to design a camera function for android version 4 (Kitkat), but i notice that there is snap picture button and ok button in the camera as picture below:
How to make it disappear and user just touch on screen it can snap the picture without the button, and the picture will directly save without need of pressing ok button.
Anyone can share me the ideas, I very need you guys help because suffer this for long time already, thanks.

how to give an event to the entire screen with so many button and other layout? android studio

i have a project that is calculator, there is many button and layout above the main layout, i have a history frame that hidden at the right screen, i want that if i swipe the edge of the whole screen and ignore the button and other objects there, the history frame shown
i already read the question here
how to fire an event when someone clicks anywhere on the screen in an android app?
but it didnt work for me
thanks
I solved this problem using dispatchTouchEvent.

Android Button background Image changes back to state in XML

I have a simple soundboard which uses Buttons to represent the sounds. When a sound button is clicked. The background image is changed using the view.
Button butt = (Button)view;
butt.setBackgroundResource(buttons_on[media]);
buttons_on is a int[] representing the drawables of the buttons.
This all works perfect, but I also use a FragmentActivity to create a paged App. The App has 4 different pages which you can swipe through. When I change a button using the above code and swipe two pages to the right and than swipe back. The image of the button has changed back to it's default defined in the page.xml.
How can I prevent this behavior?
change the Buttons to ImageButtons and setting the src?
somehow prevent the page from reloading
Instead of doing that you should look at how to use a StateListDrawable. It will simplify your approach.

Adding a slide view to images

I am trying to get images from Internet. (i can't show my code here). i AM storing a few images in a list and displaying them in an imageview each image after tapping other.
However, I want to make a slide of these images.
It's just a basic 'move to next picture' by sliding your finger on the screen.
Same as it would be in the phone photo gallery.
It's just to navigate through the images.
At the moment the image is going to the next one by the user tapping on the screen. But in this manner we can't go to the previous image. This is why we need to change the navigation to sliding a finger on the screen.
I have used View Flipper and ViewPager but how am i suppose to add images to these views after getting from internet each time.
Best Regards
here from below link you can download the example it can help you
https://github.com/nostra13/Android-Universal-Image-Loader

Is it possible to manually scroll a gallery based on a touch event captured elsewhere on the screen

In my Android app I have a gallery which contains some TextViews. I realized that some users don't understand that they can scroll that gallery although the previous and next TextViews are partially visible. So I put an ImageView with a horizontal arrow under the gallery.
Now the users try to drag the arrow. Is it possible to redirect the touch event from the ImageView to the gallery so that dragging it would scroll the gallery?
Thanks in advance,
Fri
The simplest thing (if you don't mind scrolling one item at a time) is to detect the direction of the touch event on the arrow and then dispatchSetSelected(boolean selected) on the gallery... I believe that will work. after the user does that once, they will probably intuit that they can then just drag the gallery. Of course if you want to measure the touch event speed and do the calculation for how far to scroll based on that, you can do that too... but that seems like a lot of unnecessary trouble.

Categories