How to use a single layout for displaying different information? - android

I want to use a single layout for displaying different information.
Ihave a list view. When the user selects a item from the list view it should open the layout for that list item. List view contains the name and image of the entity.In the layout it should display all the other information. This single layout has to be used for displaying the information for all the entity of the list view as per the users selection.
Bst way to picturize it is the google play store. we have a list and according to our choice the same layout is used for displaying the information for all applications..
in the list view,layout the data will be fetched from internet.
pls help..

You are basically looking for a master detail flow i guess ...
Check THIS LINK which is exactly similar to what you want ... I think the selected answer here applies to you to your question too.

You just need to do it throught your java code i dont know what exactly you want to change so i cant provide a code but you may easly find some in this website. From a quick search i found this : Editing data in a List View item and it seems to be what you want.

Related

Variable number of image buttons

basically what am doing is am querying some data from firebase and inside these data is a URL for an image of a specific item. Now since its a query i could get different result form the firebase where i can get 4 images or sometime maybe 1 image.
And i want to display the images in a grid layout ( similar to that of Instagram posts) where the user can click on an image and it shows the user some details about that item. This is the part where am stuck at.. i dont know how to do it since i have a variable number of images.
if there is a way, please help
you can use the Recyclerview and provide the model with those details. It will automatically create those many rows in list.
Here you can follow this to do this.

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.

displaying data in ListView programmatically

I'm developing an Android App and I need to display some data in a scrollable Listview.
I will extract some strings from objects that I right now have stored in linked lists (until i come up with a better solution).
I want to display a view that looks almost like the contacts app. A list with a small picture to the left and a larger text to the right of the picture with a smaller text the bigger one. When I click on one of the items it should open a new activity.
How do I create the view? If I adds an object in the linked list it should appear in the list.
I have checked some sample code, but they all uses Arrayadapter and I dont understand how I am supposed to do.
Check this article about Adapters: http://www.vogella.com/articles/AndroidListView/article.html
If you want to add new objects in ListVew use:
adapter.notifyDataSetChenged();
Check the libraries in this question, you have what you need there:
Lazy load of images in ListView

How to Create ListView like this? (Traffic Counter)

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.

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