I'm trying to create a scrollabe friends list. I'm grabbing the information for each friend off of a text file (profile pic, name, age, etc.)
So in my prototype I used different nested layouts to create one single friend entry. And to fill the list I just copied the most parent layout of my first friend and changed or adjusted the profile pic and the other text information.
What if, while the app is running, I need to update my friendslist and add another friend to the list.
How do you realise something like that?
Go for a recycler view or a scrollable list view to make a list and dynamic. You can check slidenerd's video tutorial on youtube. They are really helpful for a beginner to start any kind of app.
Related
using firebase-ui and some coding I have set up my code to work like this:
1) it retrieves data from firebase (image, text and so on), then it passes them to another activity.
2) the new activity receives datas like strings and shows them.
Just to give you an idea I am looking forward to building a streaming app. What I want to do is to show an episode list via recyclerview.
What I am doing right now is a nested scroll view and a copy-paste script to pass up to 26 episodes, but this is not a really good method and I would like to have some suggestions in order to go forward in the best way and solve this problem.
this is a screenshot of the app: https://imgur.com/a/vgBnZTA I am just passing strings to the 2nd activity, then i check if it is not a null string, if it is i hide the layout, otherwise it shows, but it is just a copypaste of code. I hope i was clear enough
Thanks everyone for your support
How can I create a ListView of videos?
I explain myself a little better, I want to make an app with a listview that contains short videos.
I create an activity list_item where I want to put images and text. For example in the first list item I want you to put a thumbnail and a description, for example: horse accident and in the second list_item put another thumbnail with another description, for example: squirrel attack.
I know how to create a list view that shows the same image in all the list_items, but I don't know how to make a list view that contains different videos, images and text for each list_item.
The images, the video and are stored in the assets and raw folder, respectively.
Do you have any idea how to fix this?
Use this library for videos using ListView :
implementation 'cn.jzvd:jiaozivideoplayer:6.2.12'
use this link for documentation : https://github.com/lipangit/JiaoZiVideoPlayer
i need to get some json data from a server and then create elements to show that data. due the data is into an array of objects, i need to put this code into a loop.
example:
name - address
save button
name - address
save button
name - address
save button
i am thinking to create an array of linearlayouts with the needed widgets inside and repeat this process n times.
am i going right? it would be great if you can help me with a point of view.
kind regards and thanks for advance.
I would create a ViewGroup, then add each child view to that. The reason for this is it is more flexible (as the LinearLayout inherits from the ViewGroup). Then you can loop through each view later to get their values if need be
no, you should use a ListView and put your data in an ArrayAdapter. There are lots of examples and tutorials for that.
I'm implementing MultiAutoCompleteTextView with email contact suggestions. What i want to have is to display contact badges in the MultiAutoCompleteTextView content instead of strings. The Gmail Android app does it.
Basically I Want what is shown in the drop down to be shown in the MultiAutoCompleteTextView (contact photo, name and email) after i typed in/selected the contact.
Is it possible?
Google does this via using a custom ImageSpan. I just implemented this successfully for one of my apps. You should look at RecipientEditTextView.java to see how they do it. Essentially they create a drawable via Canvas and assign that drawable to a custom ImageSpan. I cannot post any code since ... well there is a ton, however you should get a good idea looking thru the source.
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.