Android ListView that contains images instead of text - android

I want to make an app for Android in Eclipse, when the user clicks a button, a camera component is opened and the user takes a picture and clicks save, after that I want that picture that he just took to show in a list. Then if he takes another picture, the picture shows below the first picture and just like that.
I know how to write the code for the camera element, but how can I do that when the user saves the picture that he just took, it would appear in the listview?
Something just like a listview with text and a TextEdit, but instead of text it would be an image and instead of TextEdit it would be the camera component.
Can you help me guys? Thanks!

This is pretty simple. Just create a custom adapter which inflates a row.xml (containing an imageview) in it's getView() method and set the image in there.
There are many many examples of how to do this, and lots on stackoverflow itself. This is a nice example of creating a custom adapter with an imageview and listview.

Related

Want to Transfer an ImageView from one activity to another activity when clicked a button

I have an Activity with 20 ImageView & buttons for each Image.
The button indicates that the IMAGE link with that button will added to favourite layout.
I Want to know that how to transfer that ImageView from this Activity to Favourite activity?
Should I create a ListView in Favourite Activity or Blank ImageView?
Please help me.
If you mean you want your image view to move around from the first activity into the second activity when launching it, kind of like what happens in the play store when you tap on an app and the logo of it moves from the row to the top of the apps own page, then android has something called Shared Element Transition and This article should introduce you to it.
However, if you wan't to save the image internally, to be remembered by the application that the user has favorited that specific image, then you should look into how to store data on Android then see this guide by Google

Hi I am trying to create a e commerce app UI design like the image below

enter image description here
I have a activity and i have to display multiple fragments cards as shown in the below image.How do i organize layouts.
Please help me how to achieve the below design.
Add a view pager at the place where your images re being shown if you want to change them on swipe. Otherwise you can just put an image view and a text view to show the data of first item and replace the image and text on the imageview and textview one by one for all the items whenever you need. Let's say you can change the items after a certain time by using "TimerTask()".
This is the solution for that highlighted blue part. If I am not sounding appropriate then explain your question a little so I can help you.

ListView, Gallery or HorizontalScrollView?

Alright, I want to do something like a Gallery of images, scrolling from left to right. The user is going to register barrages, and he needs to take many picture of this barrage. I already know how to save the data, and how to show using listview with adapter, I did with listview thinking that I could change to horizontal somehow, but I searched and I can't. What should I use to do that? What I want is a gallery with the first photo being a plus to when you click it opens a new intent that take a picture and a description of the pic and save it, I know how to do that with listview, but it's not what I want. I saw that gallery view is deprecated, so I should use HorizontalListView?
Gallery is deprecated, yes. So maybe HorizontalListView.
But i think, that you can use fragments with animation
Use linearLayout that is placed in horizontalScrollView and on runtime Add pictures to that LinearLayout that has orientation set to horizontal. Best practise will be create your own class where you will have specified LayoutParams that you will apply to each ImageView generated on runtime , then you just need to add it to layout.
You can define method like addPictures(LinerLayout yourLayout,int amountOfPictures,Array pituresPaths) that will be loop which will create ImageViews for specified amount of Pictures and paths you can take from ArrayEditLike xoxol_89 mentioned you can use Fragments , advantege will be that FragmentAdapter dynamically recreates and destroys fragment objects so that solution with many pictures will be more memory resource efficient

Actions on gallery view android

i have two gallery views in my single UI screen or you may say activity, i want to have listener in such a way that on scroll of one gallery view the other should also scroll , i tried giving listener to one gallery and calling the other one gallery view into that ., but its working for me , pls can any one help me..
thanks in advance
Datta
You could try to find the position of one of the galleries with Gallery.setOnItemSelectedListener() and then update the other gallery with Gallery.setSelection().
I believe the Gallery view is missing a lot of functionality (or is broken) as compared to ListView or GridView. In this particular instance, you need a "setOnCenteredItemChangedListener" or something like that. However, the documentation does not show anything close to this.
One option would be to implement your own Gallery class using HorizontalScrollView.
Another (hacky) option would be to rely on your Gallery adapter to push the current position being fetched (which may NOT be the one displayed in the middle) and use that to guess the currently selected position.
You have to override the scroll event of your first gallery and inside this method you should call the onScroll event of your second gallery like this,
gallery_two.onScroll(MotionEvent e1,MotionEvent e2,x,y);

Android How to know if a Gallery is scrolling?

I have a gallery and when a image is selected, I want to start new thread (for loading other images). But I don't want to do it while the gallery is scrolling. How can I know the state of the gallery and if it is still scrolling?
I can't use "setCallbackDuringFling(false)" because I have a textview under the image that has to be updated during the scrolling...
Thanks!
Marc
I think you could have a go with setCallbackDuringFling method. From what I understand, if you set it to false, it shouldnt be possible to select an item while fling is being computed.
Use a Handler that is called from the onItemSelectedListener that updates the last time that an item was selected (every time the foremost item changes this listener is fired) and use a timeout value to determine when scrolling ended to determine if scrolling is still occurring.
However, I have the exact same thing in andAMP... I have a FrameLayout with a Gallery and 2 textviews to show the foremost selected Artist and Album... I use onItemSelectedListener to update those TextViews and it works fine. If you have the TextViews in a FrameLayout like me you have to use bringChildToFront to get them to show over the Gallery (add the Gallery last).
As far as Lazy Loading (which I am assuming that is what you are doing). There are a couple of great tutorials about how to do this.
http://ballardhack.wordpress.com/2010/04/05/loading-remote-images-in-a-listview-on-android/
http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html

Categories

Resources