Listview filling from database - android

good evening , I need help about filling a list view from a MySQL Database,
i don't know how to do it becaus i'm beginner in android
i wanna icon and 3 text views the first is title bold and the second is the RIB and the last one is in the bottom and right of the list view

Your question is a bit too generic and not clearly defined. That's probably why it got down voted. I'd say your best bet is to start with the documentation. Start by reading about ListView and possibly Adapter and try it yourself. If you still have problems, ask a specific question about something you don't understand or can't get working. The best specific answer I can give is that you will need to define a custom adapter to create the item view you want. You will most likely want a layout xml for that item view.

Related

how to create multiple textviews inside a fragment?

I am trying to create a fragment and inside that i want to create multiple textviews whoose text is set from the data retreived from the database(mysql).
And also i want to have the feature "refresh" by which the textviews are updated with recent data from the database.Iam trying to do that but iam not getting enough idea how to do it as iam new to android programming.
Please help me with this. thank you in advance and any suggestions are acceptable.
i.e
I have database of a person and i want to get his name and address from that,then in my activity i want to create a fragment that displays a name and address in separate textboxes and if address or name exceeds some length then i can press "more" to see left information
Consider using a ListView to populate data from the database, and a SwiperRefreshLayout to refresh it. Check these links for more info :
SwipeRefreshLayout
ListViews
The answer depends on what your app will do.
If you have a fixed number of TextViews, and the number won't change in the future or depending on the answer to the database query, you could simply stick to normal TextViews; if the number changes, I suggest using ListViews or ExpandableListViews.
Regarding the layout, you can create a normal layout using AndroidStudio's layout designer, and then inflate it to your view.
For the refresh, you can add a button that calls the method in which you fill the textviews/listviews.
Actually your question is too broad: if you want a more specific answer, you should edit it asking what you really need.

Create a ListView like view in a ScrollView Android

So I did some research and testing of using a listview in a scrollview, and as a lot of people may know this is supposedly bad to do, since they both scroll. It also means I can't show the complete listview as it will wrap to be smaller.
I have seen places which re change the height of the listview to fix this problem but again most people say that it isn't preferred.
What I would like to know though is what is the preferred way of making a nonscrollable listview like view? Basically I want the exact same as the listview but obviously non scrolled and the height based on its contents. I would prefer to work with the layout in as much XML as possible, and I would like to be able to send my array list to it to view on screen. Unfortunately either my search skills are quite dull, as I haven't been able to find anywhere that really explains the preferred method so I thought I would ask here.
Thanks for your help.
<>Clarification Information
I thought I would put this here in case it will help, first off I basically want to show an image, with a list of comments (each one has an author and a text) below it, the comments themselves are obtained from an array and can change. I want the whole page to be scrollable though so I can either view more comments or go back up to the image.
Using a RecyclerView and an adapter supporting multiple item types you could make a list which shows an image on top and several comments below it. Generally you'd have to check what item corresponds to each position - in your case on position 0 you have an image and in every other position you'd have a comment. Then in your adapter's onCreateViewHolder and onBindViewHolder you would check the item type and handle them differently.
You could take a look at this answer for a short example.
Let me know if you'd need any other details and/ or sample codes to get the idea. :)

ListView with non-uniform ListItems

I have to implement a ListView or GridView where every item will have non-uniform height/width. Also a particular item could span multiple columns. A GridView is perhaps a better candidate, but again each row has a different schematic. The attached image best describes what I want to achieve.
I am looking for ideas on how best to implement this. I am not looking for code samples, but just some guidelines.
Right now, I'm thinking of implementing a custom ListAdapter where each row is laid out in the scheme I want. Of course then I'd have to do some tricks to map list indexes to actually items in array of items (if I use and array adapter). For example, in the mockup below, the penguins will have an index of 1 in my array, but 0 in the ListView.
in these kind of structure you should use a layout in xml and add dynamic view in that layout from java file.
May be a relative Layout with ImageViews is good. It may get a bit messy for the .xml though! This seems quite interesting. Do keep us updated on which of the solutions you finally chose.
Thanks!

Whats the best way to display information in Android

I am currently making an android application which need to present a lot of information from different arrays. On each horizontal line there's gonna be four different texts and then I need to be able to scroll through all information displayed. I know ListView is one way to go, problem is I dont know how to use four text views horizontally in a ListView. Any tips or help to get the best way to present the information would be grealy appreciated.
Basically like this:
You have to extend ArrayAdapter and override getView() of Array Adapter.

Expandable list view with forms

I've been asked to make an app that has a very VERY long data input form (we're talking around 50 fields here!). Thats a design constraint and there is absolutely no way for me to work around that.
What I'm trying to do is to display the form in a way thats easier on the user. My idea was to break the form into sections and somehow use an expandable list view to display the form. The list group would be the section name and the list items would be the input forms.
My problem is that since the form can contain different types of input fields (checkboxes, radio buttons, textfields etc) and since I'm new to android programming, I dont really know how to do this. All the online tutorials I can find are about simple uniform expandable lists. Can someone suggest me a good tutorial or an alternative to my idea?
I would look into using ExpandableListView as is, but create your own xml layout file for each list 'child' row, putting the field name and then a text input field for the value into it.
Have alook at this page where the author shows how you can put a 'checkbox' next to each list items row:
http://mylifewithandroid.blogspot.com/2010/12/expandable-list-and-checkboxes.html
You have to use child layout view for achiving this.
follow below link and find the code,Inflating only one text view but u can inflate the complete layout(I personally used that thing in my code).
Expandable list view
What you're going to need to do is extend your BaseExpandableListAdapter and customize it to display all the various layout options. Specifically, it's going to be the getChildView() method that you'll have to do the most work in. Do some searches for customizing or extending the BaseExpandableListAdapter and you should find plenty to go by.
Also, take a look at the example from the SDK:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html
Edit: Link not available

Categories

Resources