Good Morning All,
I am creating an application to display List of applications with their data usage.
I want my list to look similar to Traffic Counter Pro on android Market
I have also added the print-screen on my box.net as SOF does allow me to upload image
So Can someone direct me how to create ListView like this?
My second Question related to this how to create a tab style Activity.
Two examples that helped me a lot:
http://www.codemobiles.com/forum/viewtopic.php?t=876
and
http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
i hope they are usefull to you.
You have to use custom ListView to embed images and format texts as given in the listview.
check out this example or this example or this example or even this example that gives you good understanding on listviews.
Good luck.
This is ListView which items consist of 4 Views objects, look through the tutorial of how to create ListViews and through the tutorial of how to create TabActivitys. And also use links suggested by #parag.
If you observe the screen shot carefully you can identify that group of these fields are available as list item.
They are
Application Icon
Application Name
Data Uploaded
Data Downloaded
Total Data Usage
So you have to create a layout with these fields as children with appropriate position and Use this custom layout as child layout for ListView.
I hope it may help you.
Related
I have made few Gallery modules by using GridView i have used this tutorial: http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/,
but now this time i want to make it more custom for my usage, i want to Categories Images, Please see below Screen Shot
I will be use static images under specific Categories
How to make this kind of Image Gallery:
I have never tried, but i have found this sample code, and please try to custom it as you like:
http://blog.blundell-apps.com/infinite-scrolling-gallery/
you can do it by implementing Jeff Shrkey's SeperatedListadapter
http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/
and you can
Look 1
Look 2
There isn’t an easy way of creating these separated lists, so I’ve put
together SeparatedListAdapter which does it quickly. To summarize,
we’re creating a new BaseAdapter that can contain several other
Adapters, each with their own section headers.
Create a Layout having a TextView and custom ListView. in each listItem have a GridView. and Load GridItems.
The TextView is for the Category Name.
Basically you must combine, the Custom ListView Implementation and GridView Implementation to achieve your objective. You can find Separate Tutorials for doing the same in the same androidhive website. But, you must work on combining them into one.
The page layout is like:
An header image first
a table or list with one record each line
for each record, it has an image and 2 text view
how can I design this layout and populate the data dynamically, e.g. via web download or an data file(xml/text format)?
I can't figure out how the binding works and should I use a table layout with table row or just list view with some customizations?
Actually, this is going to be a broad question because you are asking about to fetch data from web and also need to customize the listview to display data.
To fetch data from Web: You haven't mentioned whether it is SOAP or RESTful webservice? Also what you will receive in response i.e. XML or JSON? For best, i would suggest RESTful with JSON.
To customize ListView: I can give you answer for customizing ListView, for that you can create a custom adapter class by extending BaseAdapter, implement the onView() method with inflation of custom row layout file (1 ImageView + 2 TextViews), check this: Android custom adapter for ListView
The page layout is... it has an image and 2 text view.
Elaborating on jitendra's answer: Yes, a ListView seems ideal for this set up. A TableView is doable, but is really more ideal for a rows/columns structure and that does not sound like what you need.
How can I design this layout ... ?
You would use the android XML to name and style the elements. The best practice is to make a layout file for the screen containing the list itself. Make a second layout file to house a generic record. In other words, you typically design the record separately from the list and its containers. There are several great tutorial on Layouts on the Android Developer's website.
How can I... populate the data dynamically?
There are two parts to this question. First, in code you will need an Adapter of some kind to convert the Data to the actual Views. The ListView will be linked to the Adapter. The Adapter will inflate the Layout XML that you create for the Record. Different Adapters have different guidelines for customizing the Views. As mentioned by Paresh, a BaseAdapter is a great class, but you really should look at the different Adapters provided and see if they already meet your need.
Second, to get the data...1) from the web depends a lot on your web server and how it distributes data. Without more information, you are unlikely to get any solid answers. We can only make recommendations. 2) If you are going via a data file, things change considerably. You can make an Array of objects from a custom Class designed around your data. If you need Sorting, a Tree might be better. If each record has a unique key, a Set or List might do you well. Based on your question, I find myself assuming that you are unfamiliar with Android development, so I would recommend a datafile loaded into an Array with an ArrayAdapter. This will at least help you get a little more familiar with your own project and how it relates to the Android environment.
I can't figure out how the binding works
Unfortunately, it depends on your View and its Adapter. A CursorAdapter does most of its data binding in the bindView() method of the Adapter, but inflates the View in the getView() method. A BaseAdapter does this in the onView() method. If you need to get more familiar with Adapters and their capabilities, read the Android Developer Resources. They have great samples and code. Also, do a search there for "custom adapter" and you will be linked to a ton of other tutorials.
At this point, I recommend strongly, two actions for you. 1) Make a few decisions. Either you get the data from the web or a data file. If you want to do the other later, great. Get a handle on one, that way we can help you more effectively. 2) Use both Google and Android Developer Resources search functionality with the phrases that define your project. If you add the word tutorial or example, you'll be sure to find plenty to help you make those decisions so that we can tailor a solution that meets your needs.
Hope this helps!
FuzzicalLogic
According to your requirements ListView would be good, and you would need to use adapter to bind data with view.
Please read about listview and adapter to implement these.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:background="#drawable/img_list_background_repeater"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/empty_category"/>
<ListView
android:id="#id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
No one will give you all java class and xml both.
You frame a xml. Then using adapter try to implent data to the list view.
If then you have any problem, provide your code. Then that can be solved.
I want to have more than one dynamic listview with title in one signle activity.each list item has the image and it's name.i have to do like below image.Please suggest any solution.
Thanks,
you have two options:
i) either partition screen in two parts using weight attribute and use different listviews.
or
ii) you can take a look at good tutorial here for an idea.
one more concept if you find easy is using MergeAdapter
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
i am quite new to android and i was wondering how i could go about adding a listview with different images and text. What i am trying to achieve is a listview with four rows which have a different Icon? I don't know how to set that up using the xml layout provided. should i build this using different multiple linear layout or is there a better way to go about it?.. All the examples i have seen all seem to be using one particular Icon and no much detail of the xml layout. Any help will be greatly appreciated. Thank you
If you have a fixed number of rows you can just use a LinearLayout and save yourself some headache. If you need to have a dynamic number of rows then you need to make a custom adapter for your list. If you do a Google search, there are a lot of tutorials on how to do that.