Showing detail from a ListView - android

What is the correct way of showing a new View with more detailed information from a ListView in Android? It's a topic that I can't find a solid answer for in either of these Android books.
For example a list of contact names, one is selected and a view shows their full details.
Do I launch a new activity for this or use a ViewFlipper?

Your approach is right. It's the recommended one.
When designing an activity, it's suggested to use this paradigm:
One activity = one thing to do.
Viewing the list
Viewing the details
On the Notepad tutorial app, a new activity is launched to view the details of a list item.
Anyway, the ViewFlipper is another possible approach that keeps all the content in a single activity. This approach is suitable if you manage the Back key correctly.

Related

Single fragment to load multiple layout android

I want to make a quiz application for android,where each page will have a single question and on click of next button second question will be displayed,
I want to keep the next button common and use single fragment to display different layouts on click of next button.And on the basis of answer submitted next question will be displayed.
How to achieve this.How to use single fragment for multiple layout and maintain its stack.
Using different layouts to load various questions would be an incorrect solution to your problem, rather fetch the data from your question bank(xml, excel, db, any source) and set your question TextView to it. The Multiple choice answers(if any) could also be populated in the same way on a single fragment. You would just need one single layout.

Listview navigation in Android

I have a custom Listview in my android app and on list item click, I'm able to navigate to other activity, which shows all the details about list item !! Now my question is, I want to navigate to next/previous listitem's details through second activity.. how can i do this.??
I'm new to android and stackoverflow as well..
Thanks in advance !
I guess this is more of a design question, so i'll answer that way -
Your best bet will be to use something like a ViewPager in the new activity, which receives the selected item position and displays it with underlying adapter having the same items from the previous activity. using the ViewPager the user can swipe left and right between items.
For a good example on this usage, you might want to take a look at "Google Reader" on Play Store which has this exact same design pattern.

two listviews in fragment?

I'm new to android development, and I have doubts about working with fragments.
I have to build an App that runs 2 ListViews on the same screen, but the list on the right depends on what I select in the list on the left. I've looked through all the tutorials and samples about the working with Fragments, and I haven't found a way to do that succesfully.
Hey refer this link and follow the example explained there. In the example given you have listfragment and when clicked on an Item, details will be changed. So You implement another listfragment which will display items upon selection of first listview instead of Details.

How do you organize an application with a list of items, which link to a lot of activities?

I am making an application and I can't figure out what's best to do.
I have a long list of tableRows. About 200 of them. They are different
models of a specific product. Each row, when clicked, should show a
screen with that item's specs for the user to read.
Here are my options, I would need help and guidance on how to do each one of these as I am a beginner (but I'm getting more advanced)
First Approach
Create an activity for each and every item. The user will click the row and then they will have to press back to get back to the list. (I know how to do this. I'm fine with this)
Second Approach
I read about horizontal page swiping. Similar to the Play Store. I would prefer this option, but would I be safer sticking to lots of activities?
When the user clicks a row, it would bring them to the item spec and they will be able to swipe left and right between all the items. Pressing back will bring them back to the list.
(This is the one I need full step-by-step guidance with, so I can learn for the future, thanks)
Does anyone have any other suggestions how I would handle this amount of data?
Thanks
You have a long list of items. That suggests you use a ListActivity to show the items. If the items have similarities, use one view to show them and one Activity to show details. If the items are totally different, use different layouts to inflate in getView and different activities. Having the items in one list suggests, however, that there are similarities and it's best to use one layout in the listview and one activity for details.
Alternatively, you can group your items according to similarity in the way you show them. You may end up with ten different views to use in the listview, and ten different activities.

Navigation app in Android, populating data

I am developing an Android App on which I get a list of events from DB and put them on a ListView. Every item can be clicked to see event details and every detail can be clicked to see statistics on that detail. What is the best approach for populating data? I have an activity that launches a new instance of the same activity to populate the new ListView.
Is it the best thing to do or is it better to do it in another way? I've done something similar in iPhone with the NavigationController and I would like to replicate the navigation forward-backward in Android.
Thanks in advance.
I suggest that you have a look at the NotePad sample, which is similar in what you are trying to do:
It demonstrates how to connect to database
It will teach you how to create a custom url describing your data and how to use this with Intents
It demonstrates switching from a listview to an itemview
It shows how to add/edit/delete items
What it won't show is the statistics view you want for the events. If I were you, I would create a different ListActivity for this and not reuse the main list view.

Categories

Resources