• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Endless Views

Maxood

Lurker
Sep 13, 2009
3
0
I am developing an application in which a user keeps on scrolling
vertically. Each view displays a single text on a drawable background.
How can i obtain endless views?
Is it a ListView do i have to use here? But how can i make a ListView
not to end and keep on going forever until the application is
terminated by the user?
Is there an attribute or i have to do it programatically? Please
explain.
Hope my question is clear.Waiting for the reply.

Maxood
 
There are 636 facts in total. Each fact is fetched from the database randomly and displayed on the view.There are 27 drawables (background images) on which each fact will be displayed. These drawables are meant to repeat themselves randomly or sequentially.

I need infinite scrolling as the facts and views keep on repeating them as the user scrolls vertically.
Hope you understand my requirement. This is the layout i have made.



Now i need to have these views repeating them. How can i do that?Thanks

Maqsood
 
Upvote 0
I'm still in my early phase of learning Java, but I would imagine it may be best to set the visual template of what you want and populate the background image and on screen data using a while that just never reaches it's conclusion.

I would do it using someting like
Code:
while (true statement) {
    randomly.display.fact 
}
Your 'true statement' could just be that the next fact has been called for. While it's not technically infinite (in the sense it'll just keep running and eat up your memory and crash), it just always keeps going and you can create a function to randomly select a number/id/name/fact/whatever for the data to display. Maybe include an array that is storing the last 50 or so shown facts that you can check the randomly generated fact against so that they don't repeat too often. So I can't be more help with actual code, but that's the logic I'd approach this with, hope it helps!
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones