Give a possible way to display data - android

tell me how best to implement the following representation of information
20.10.2014
7:00 some text
7:30 some text
18:00 some text
21.10.2014
7:20 some text
7:21 some text
7:22 some text
22.10.2014
7:20 some text
I know the following solution - ExpandableListView but then the children can curl up. but I do not need or TableLayout with TableRow but I need to fill in the data from the array and implement the click event for each element except the parent.if you ask a stupid question and give direction where to look, I'll delete it
even without the events. usual display of text from a file in a form

Option 1: Use Multiple Views in ListView
See this tutorial and this answer (it is harder one you will need a simple adapter).
It will help you in creating a adapter with two different layouts.
Option 2: if you don't want it to be so much complicated use simple base adapter and create a view with both date layout and event layout and change it's visibility.
Option 3: In More Simple way create a mutliline text view in scrollView then make your text more formatted using spannable string.

Related

Listview filling from database

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.

Customising a row of listview

I am a newbie to android.
I am trying to develop this UI. This is a single row of listview.
I have tried diff ways but not able to this.
Here in this pic, I know how to set that bubble background and use ninepatch and customise listview.
What challenge for me is I want to display some text here after button.
In case if the string is long i.e going to nextline than It should continue below the button.
Please suggest me how to move forward.
Should I use two textviews and check if the first textview is filled than further string should be displayed in the second textview or any other way.
You can use ArrayAdapter or BaseAdapter. Check out the following links
most recommended
link
tutorial1
tutorial
tuorial3
EDIT:
Use seperate Linear Layout for both the view. It should do the trick

Custom controls/inflating an XML onto an Android layout?

I have a standard layout and i have to populate it at runtime with a number of controls/views i.e. TextView / EditText depending on the number of products that come back from a REST service.
Of course the control I wish to add to the layout at runtime needs to contain a number of views (textview, edittext) etc. I was thinking a custom control to bring all the controls I need I am unsure.
The other idea I had was to inflate and existing XML into my layout but I am unsure if this is possible or if it was or would I control the ID names - inserting more than 1 would cause duplicate id's?
I will try and explain in detail what I am trying to do, we can wrap it in a for loop for test which would count form 1 to 5 hence 5 controls would get populated on my layout.
The custom controls would have a TextView which describes the product. The Edit text where the user can enter freely the amount in numbers using the virtual keyboard and a spinner control to the right of the EditText which would allow the increasing of the EdtiText value.
So all pretty simple eh ? :-) but of could I class all these controls as 1 specific view and I need to a number of them on my layout hence if there were 5 products there would be 5 custom controls, each custom control contain controls i.e. TextView, EditText and Spinner.
How can I accomplish this?
The examples I have seen have been inheriting from VIEW but I need my VIEW (CUSTOM CONTROL) to be a container for a number of other controls and then later be able to dynamically add this new custom control onto my Activity Layout.
What about using a ListView with custom adapter...
check http://www.ezzylearning.com/tutorial.aspx?tid=1763429
http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/
You may want to use a ListView with a custom Adapter, and update the adapter with the information from the service.

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

android custom listview row formatting question

I have a listview that I am trying to customize. The issue I am having with eclipse's android plugin is I am not quite sure how to format the text portions and wrap them around my icon. Here is a diagram with what I am trying to do:
I need to know,
1. Advice on formatting text to fit the row. for the top, i want 3 different strings to fit (what they can) into their own column and ellipsise at the end. easy enough.
2. I want to do something similar for the bottom row but give it a max length. Say each column can contain up to 20 characters, including the (...) ellipses. it may contain 1-7 columns. So I want the overflow to go to the next row and wrap under the icon.
3. Perhaps someone has a war story with a custom listview they want to share? How did you fit all the information in the item, or did you use an alternate view such as GridView instead?
Thank you.
For point 1: You can use LinearLayouts for each row, using the weight property on each element according to your needs.
For point 3: in order to make the text to ellipsise you can use the property
android:singleLine="true"
although it has deprecated, or use
android:inputType
with anything in order to not set the textMultiLine flag into true
For point 2: i cant think of doing this in other way than programatically

Categories

Resources