Programming logic/ API experience help? - android

I need to create a list which will all be programmed in the java code and not XML as the items within the list require processing. The left side will have a string and the right side will have a numerical value for each row. This is somewhat like a listView only slightly different as there are two variables for each row one on the right and one on the left. I need to be able to define and add rows freely in the code. How do I go about in programming this type of list into my application. Thanks in advance for any help.

Please refer to the List3 Example (Cursor (Phones) Example in the API Demos) for an example of how to display columns of different types in a list view.
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List3.html

Related

gridlayout or table layout

I am trying to create a candy crush like game. Correct me if I'm wrong, but the way I see the basic logic of candy crush, several rows and columns were created and objects (e.g. candies) are placed on each box, forming a pattern will erase previous objects and will be replaced by a new one. My question is, shall I use a grid or table layout? Shall I create an array for objects (e.g. food, crackers) where it will be placed? are buttons in android shall be used to swap it with different objects?
Thanks for the help. Android newbie here. :)
Definitely check out the official docs for your use-case.
GridLayout: http://developer.android.com/reference/android/widget/GridLayout.html
TableLayout: http://developer.android.com/reference/android/widget/TableLayout.html
I'm not familiar with the candy crush game but from your description I would use a Table Layout as it looks like every item you'll have will stay in its' assigned cell. GridLayouts are very helpful if you have Views that extend past their cell boundaries. Just in case you should decide to use a GridLayout here's a wonderful article on them: http://android-developers.blogspot.com/2011/11/new-layout-widgets-space-and-gridlayout.html
"Shall I create an array for objects (e.g. food, crackers) where it will be placed?" - That sounds like a fine thing to do to me!
"are buttons in android shall be used to swap it with different objects?" - Buttons are simply a type of View, replacing a Button with some other View inside a TableLayout should be pretty straight forward.
I know this was asked forever ago but maybe this could help someone? GL!

Contact list design suggestion

I'm constructing a custom contact list with 5 required fields. It's a bit difficult to fit all 5 in a single row without looking like it's cluttering or doing nested rows which make it hard to distinguish the rows. Here are a couple of designs that I came up with (below). Is there a better way to organize the fields, such as expanding the row when selected to reveal more info, or simply make the row height bigger? Any suggestions?
Not so clear what your five fields are. Most important field(s) (e.g. name or contact number) should be at the top in bold style. The second row should contain less important fields, but you need to put enough spaces and style to distinguish them. You should also use ellipsize(...) attribute to contain them within the boundary. If it is important to show the whole string, you may even use third row for any field. Hope this helps.

Layout design help Android

I am using a web service which gives me a list of all the people in alphabetical order. I am showing this list in a Spinner.
I would like to separate the list into sections by the first letter. The user would then select the section (e.g. A, B, etc.) of that list of people that will be loaded in spinner.
What is a good and intuitive way to design that alphabet view for the user?
I thought about two drop downs: one for letters, and one for the list of people but that doesn't seem to improve it.
Any help?
Thanks
Based on what your describing it sounds like
an expandable List View showing letter the first letter of the name and expanding to reveal all persons with that name.
Take a look at this pic.
http://techdroid.kbeanie.com/2010/09/expandablelistview-on-android.html
What I did was: Created two listviews side by side with alphabets as well as people
like this
with which you can scroll alphabets one side and corresponding people will load on other side.
Thanks

Which Adapter to use?

REQUIREMENT:
I am working on GRE vocab app. I have requirement in which I will be showing word at the header level and four meaning in the lower section and out four meanings one will be the correct one.
I will be using TextView control to show these words and meanings.
QUESTION:
I want to implement adapter? I don't know which one suits? which Adapter? my requirement is basically show line and header details.
I'm not sure a ListView and Adapter make sense for you.
Why not add your four options to a LinearLayout and keep it simple?
Much of the adapter infrastructure is dedicated to recycling views, avoiding pre-loading a large number of rows, and dealing with multiple types of rows. If you don't need any of this, then a LinearLayout might make sense.
Use the ArrayAdapter with either a String[] or List of the definitions.

Android DB List Adapters: multiple columns, aligned?

Ok I can't find a sample anywhere.
I've done the notepad tutorial on Google's Android site, but I would like to know how to add more fields to the list, in columns. At the moment I can add the columns no problem, but they're not aligned like you would a normal table on the layout:
john smith
heinrich cilliers
will peck
I would like the first names and last names aligned proportionately, as you would in an html table.
It works if I use a constant value for the layout_width parameter (100dip etc), but I would prefer to use a relative percentage. However it's becoming clear that each row is on it's own, and does not know how to alighn itself with the row above.
Any pointers?
UPDATE: I've reached an experienced Android developer which advised me to use WeightSum, which brings me closer, but vertical alignment is stil not happening:
I think therefor you have to extend the ListAdapter.
http://developer.android.com/reference/android/app/ListActivity.html

Categories

Resources