Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

ListView - next previous about another Activity

Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have 2 activity, in one activity i have listView and in another activity i want next and previous of ListView the fist activity...

Thi is code:

this is another activity where i want show row about buttons next and previous:

Posts: 4179
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing you should do is write up a very detailed specification about what you need to do. Then you need to consider the requirements for implementing the specification. Then you need to plan out the code to implement the specifications, give the requirements. Finally, when you have code and a problem, you can ask a specific question here.

What you seem to have done here is come up with an almost - specification. You probably know what you want, but you definitely didn't communicate it well, probably because you didn't flesh out all the details yourself. Then you posted code without attempting to implement the specification. So we can't really look at the code to see what your intent was. Also, since you didn't try to write the code, you aren't getting an error and don't have a specific question, so it makes getting an answer take longer. Part of the reason you don't have code is probably because you don't really know 'where to begin.' Knowing where to begin comes from understanding your specification, and coming up with the requirements to implement that specification. Since you are the one writing the app and have the concept, you need to come up with the specification, and from that you should be able to come up with the requirements (and from there, code to attempt to implement them).

For example, you said:

paul beppe wrote:i have 2 activity, in one activity i have listView and in another activity i want next and previous of ListView the fist activity...

I don't really know what that means, but if I were to take my first translation and turn it into a specification I might come with:

steve luke wrote:I have an ordered list of names. On one activity I plan on displaying those names as a scrollable list, such as you get with a ListView. In this first activity the user will be able to click on a name and be brought to the next activity.

In the second activity, I intend to display details about the one name the user clicked on. In addition, I want to provide navigation in this second activity that allows the user move from one name to the next: I intend to use next and previous buttons to perform this navigation.

In the above diagrams, if a user comes to Screen 1 and clicks on Giovanni, then they should get to Screen 2. On Screen 2, we have details about Giovanni. If the user presses Previous then Screen 2 should re-appear, but this time with information about Antonio, who was the name before Giovanni on Screen 1. If instead the user presses the Next button on Screen 2 (while viewing Giovanni's data) then they should be brought a view with Michele's details.

If the user navigates to the first name on the list then the Previous button should be disabled. If the user navigates to the last name on the list, then the Next button should be disabled.

With the above specification you can tell that you need access to the same list of names on both Screen 1 and Screen 2. You probably should realize that Screen 2 needs to know its current location in the list. So I would consider passing the Index into the list / array for the data that Screen 2 requires. Screen 2 could then use that index to look up the current name, and can make an identical Intent as Screen 1 does (in its onItemClicked method), but passing the current index -1 for previous, and current index + 1 for next.
I've never won anything before. Not even a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!