Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialScott Junner
9,010 PointsWhich Adapter to use?
I'm stuck on how to move forward with an app. I have a basic layout which is a 2x3 grid pattern of RelativeLayout(s). If I was to write all this in a single boilerplate layout file it very quickly becomes unmanageable. So I of course want to be DRY in my approach.
I want to find some way to use an Adapter to build out the screen programatically and still have a bunch of independently functioning views. This image http://imgur.com/a/WAp4f is a guide to how the app will eventually look. 6 independent settable timers which can all run coincidentally.
It seems very much like using a GridView will not work in this situation. And so it then seems that using an ArrayAdapter isn't the option for me. I'm sure there is a way to do this but I just can't wrap my head around how it will work.
If there is someone who can explain it to me, that would be very cool.
Which Adapter should I use? I think that's the best place to start.
Scott Junner
9,010 PointsI think you probably understand my problem a great deal more than I do. A had also suspected there was going to be big problems heading my way with threads. So, yes. I'll do that.
1 Answer
Ben Deitch
Treehouse TeacherYou'll need to create your own adapter. You can probably do this with a GridView, but you can also do it with a RecyclerView. Check out the Lists and Adapters course to learn more, or just jump to this video to learn about custom adapters with Ben J.
Scott Junner
9,010 PointsI had not even seen the existence of a RecyclerView. Thanks for pointing that out. Lists and Adapters course is in my list of stuff to get through.
samuel zaffran
24,815 Pointssamuel zaffran
24,815 PointsWhat do you mean by have a bunch of independtly functioning views ? If i did understand you want to launch multiple timers in the same time or at least launch and stop the one you whenever you want ? If it's the case you should consider having a multiple threads solution cause you don't want to block your ui, i recommand you to take the android course about thread and services it might help you.
If it's not the case or i missunderstood please explain me. Hope this'll help.