Office Hours — Today, September 19

Yesterday, September 18

Sep 19
7:20 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:30 PM
Pedro T.
has entered the room
Pedro T.
Hi!
Mark M.
howdy, Pedro!
how can I help you today?
Pedro T.
well, I'm doing a little app that retrieve information from a Json and show the results on a listView
Initially I used a simpleAdapter()
but now I want to iterate the colors to make the odd rows one color and even one's another
so I was looking for a custom adapter
I read about extending it to baseAdapter
but it doesn't let me create the constructor with all the data I'm suplying
to the adapter
that is the same that was supplied to the simple adapter
7:35 PM
Mark M.
why not just extend SimpleAdapter?
Pedro T.
View paste
for now the adapter is working like this //adding the results of the parsed JSON data to a listView using a ListAdapter
				ListAdapter adapter = new SimpleAdapter(DataconectActivity.this, jsonResultList,
						R.layout.datalistitems,
						new String[] { TAG_NOMBRE, TAG_PRECIO, TAG_DESCRIPCION }, new int[] {
						R.id.dbnombretxt, R.id.dbpreciotxt, R.id.dbdisponibilidadtxt });
				
				// add in a ListActivity We need to make
				setListAdapter(adapter);
Mark M.
override getView(), chain to the superclass, adjust your colors, and return the result
Pedro T.
I'll try it now
7:40 PM
Pedro T.
Is there a guide of theory of wich type of adapters I can extend a class? because as far I read I never get to this on the book, by the way thanks it worked perfectly
7:45 PM
Mark M.
AFAIK, you can extend any of the Adapter classes
if you extend CursorAdapter, or something that inherits from it (e.g., SimpleCursorAdapter), you would override newView() and/or bindView() instead of getView()
Pedro T.
oh great so I can use the CursorAdapter in the sameway
Mark M.
otherwise, override getView()
yes
Pedro T.
so what about the perfomrnace of using bindView I made the Expandable list example of the book and also see the solution and I noticed with the solution, that is not to responsive, for the last options. so, I don't now if that will work with big data amounts
Mark M.
I have very limited experience with ExpandableListView and cannot comment on its performance
7:50 PM
Pedro T.
I guess I will have to give it a try on of this days
7:55 PM
Pedro T.
well dear Mark I guess I will see you on the chat as I go reading the book, for now I'm happy I'm learning a lot your book is really explicative. see you later
and congrats for all the work on this great book
Mark M.
OK -- see ya!
thanks!
8:05 PM
Tom O.
has entered the room
Mark M.
howdy, Tom!
how can I help you today?
Tom O.
A hoy hoy
Looking for some guidance / advice on a UI pattern
Kind of like a ViewPager, but with multiple ViewPager instances
IIRC, ViewPager only supports one view correct?
Mark M.
depends on how you define "supports"
Tom O.
and you can only have one ViewPager / activity?
Mark M.
that blog post shows three ways a ViewPager can show multiple pages at once
the first technique is also covered more in the Large Screens chapter in _The Busy Coder's Guide to Android Development_
in terms of number of ViewPagers, that depends on your adapter
FragmentPagerAdapter and FragmentStatePagerAdapter only really work well one per activity
if you fork one, or roll your own PagerAdapter, you should be able to have more than one ViewPager
Tom O.
Hmmm, okay.
Mark M.
however, I really worry about usability with what you're describing
aren't users going to get mystified by all sorts of separate horizontal swiping things?
Tom O.
Mark M.
oh
8:10 PM
Mark M.
personally, I'm not a fan, but I know there are apps that use that
Tom O.
It's more a request of a client.
Pedro T.
has left the room
Mark M.
:-)
Tom O.
personally, I think it would make a UI to busy ( to much horizontal swipey stuff)
Mark M.
agreed
Tom O.
but they are curious how to do it.
Mark M.
ViewPager could do it, though I suspect the earlier implementations of this pattern perhaps used HorizontalScrollView
Tom O.
That is what Stack Overflow says :)
Also, do you know if Jake Wharton's ViewPagerIndicator has to take up the whole screen?
Mark M.
I'm not aware that *any* take up the whole screen, but I've only played with his TabIndicator
that one's height is roughly the height of your text
at least, AFAICT
I haven't loaded that activity into Hierarchy View to see if he's doing something tricky that's not obvious from just examining the activity in action
Tom O.
Hmmm, sounds like I might just have to code up a couple of simple spikes and see what they like best.
Mark M.
that's probably a good idea
8:15 PM
Tom O.
Although I like the 3rd option on your blog.
thanks for the help!
Mark M.
definitely follow the comments on Dave Smith's gist
there's a bug in ViewPager that his original solution tripped over
I think is updated gist fixes it
er, I think *his* updated his fixes it
sheesh, I can't type today
I think *his* updated *gist* fixes it
Tom O.
LOL
Thanks for the heads up.
(on the updated gist)
Mark M.
no problem -- we even had to drag Romain Guy to help figure out what was going on... :-)
Tom O.
Mark M.
that's it
Tom O.
Ah, a fun day of Android bugs.
8:20 PM
Tom O.
Anyway, thanks again for your help. Have a great night.
Mark M.
you too!
8:30 PM
Tom O.
has left the room
Mark M.
that's a wrap for today's chat
next one is Tuesday, 4pm Eastern
have a pleasant day!
Mark M.
turned off guest access

Yesterday, September 18

 

Office Hours

People in this transcript

  • Mark Murphy
  • Pedro Teran
  • Tom Opgenorth