Office Hours — Today, April 17

Thursday, April 11

Apr 17
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
10:00 AM
Tamir
has entered the room
Mark M.
hello, Tamir
how can I help you today?
Tamir
hi
i am trying to use Viewpager
and my problem is that it's load the next fragment
i mean i have the current fragment and the next one is cached
and i dont what that to happen
Mark M.
you do not have a choice
ViewPager will always have at least three fragments loaded
you can ask for it to pre-load more, but not less
Tamir
i cant do it with pager on change listner?
Mark M.
no, sorry
Tamir
and one more question about pager
10:05 AM
Tamir
i want to display more pages to authenticate users
is that possiable?
Mark M.
I am sorry, but I do not understand your question
Tamir
i mean can i change the number of pages for authenticate users? i want to allow a special views for loging users
login
Mark M.
in theory, you can call notifyDataSetChanged() on your PagerAdapter, to tell the ViewPager to reload everything
you would do that after authentication, to have ViewPager update itself to reflect the additional pages
that being said, I have not tried this
Tamir
i thinks that for now thats all my questions Thanks !
Mark M.
OK
if you come up with another question while you are here, just let me know
Tamir
thanks again bye
Tamir
has left the room
10:15 AM
Tamir
has entered the room
Mark M.
hello again! :-)
Tamir
hi :-)
i want to rephrase my first question
first i will tell you a little bit about my app
it uses viewpager when the first page is a map and the second one is fragment
the second view has a background thread that get information from a site using http get request.
i want the information to be loaded only when the user switch to the view
i dont mind that the second fragment will be loaded with empty list and only when the use switch to him the information will loaded
will load
Mark M.
I would think your user would want you to start downloading the data immediately, so it is ready when they switch over to that page
10:20 AM
Mark M.
regardless, *that* you can handle via an OnPageChangeListener
have the listener tell the fragment "hey! you are visible now! go do the download!"
Brett G.
has entered the room
Tamir
i tried that , but the app crushed :-/ so that was probably my bad thanks again ..
Mark M.
hello, Brett!
Brett G.
Good morning sir!
Mark M.
Tamir: OK
Brett, do you have a question?
Brett G.
I need a spinner that allows selecting multiple items, what would you recommend
Mark M.
I'd recommend a case of Red Bull :-)
I'm not aware of a way to do that readily
Brett G.
haha, i'm thinking custom listview activity
10:25 AM
Brett G.
or fragment, thought I'd check before starting on that :)
Mark M.
I guess I do not completely follow what you mean
do you mean that you are going to replace the multi-select Spinner with some sort of button that launches another activity?
Brett G.
just transition to a new full screen listview that allows multi-selection, yeah, what you just said :)
Mark M.
oh, OK
Brett G.
That's what I'm currently doing on iPhone
but the spinner looked like a promising alternative at first
Mark M.
you could do a multi-select list dialog instead, if you didn't want a separate activity
Brett G.
and it is great for a single selection
Mark M.
unfortunately, neither Spinner nor ListPopupWindow support multiple selections
Brett G.
ooh, that sounds interesting, looking it up now
can the dialog scroll for lots of items?
Mark M.
while it is conceivable to rework one to support multiple selections, that's a case-of-Red-Bull level of work
dialogs can have as many items as you want
Brett G.
yeah, that's what I was thinking
Mark M.
look at AlertDialog.Builder, specifically setAdapter() or setItems()
Brett G.
k
Mark M.
or actually setMultiChoiceItems()
like a Spinner, you could update the caption of your trigger View (e.g., a Button) once the dialog closes
Brett G.
so it has listview style scolling?
"scrolling"
Mark M.
the dialog? yes
in fact, the dialog is hosting a ListView
Brett G.
Awesome! That's exactly what I'm looking for.
10:30 AM
Mark M.
let me swing back to Tamir, and I'll be with you again shortly
Brett G.
That's a lot cleaner than bringing in a new fragment. Thanks a lot!
Mark M.
Tamir: do you have another question?
Jose L.
has entered the room
Mark M.
hello, Jose!
Jose: do you have a question?
Jose L.
hello!
yes, kind of a general one
how can we implement something like the chat heads of the new facebook app
something that stays over the rest of the apps
Mark M.
to be honest, I would prefer that you did not implement such things
that being said, read the Tapjacking chapter in the book
Jose L.
haha I know, I don't want to do that, just wondering how
Mark M.
it discusses how to have a Service display something that overlays the current contents of the screen
Jose L.
I guess that's what apps like swapps use too, right?
I don't know if you know it
Mark M.
I vaguely recall it
any sort of "always running thing that can get touch events" is using the same basic techniques
at least the security issues raised by such techniques were fixed as of Android 4.0
10:35 AM
Jose L.
I see
ok! thanks!
^^
Mark M.
Tamir: do you have another question
Brett G.
View paste
I have a couple of ActionbarSherlock/HoloEverywhere questions. 
1.  I have a ListView with a custom ListViewItem that contains a button.  This is the only screen in my app that doesn't use the HoloEverywhere theme.  The button is still styled with the old style and is orange when pressed.

2.  Is it necessary/recommended to include the org.holoeverywhere namespace for every widget in my xml layouts?
Mark M.
I have never used HoloEverywhere
personally, I do not recommend it, as users of Android 2.x devices may not recognize things like the newer EditText styling
Brett G.
gotcha
I'm not well versed on this yet, but is it possible for me to create my own "theme" that's backwards compatible, so I only have to design and code the layout once?
Mark M.
um
Brett G.
I should say, is it "simple"
Mark M.
well, I don't completely understand the question, but you can use versioned resources to have a custom theme inherit from a version-specific base theme
you see this with newly created projects in Eclipse, if you have it create an activity for you
10:40 AM
Mark M.
AppTheme is where you put your custom stuff
Tamir
has left the room
Brett G.
OK, I'll do some reading on that and see about moving away from holoeverywhere
Mark M.
it inherits from an AppBaseTheme, that itself has multiple versions with the proper inheritance (e.g., Theme.Light vs. Theme.Holo.Light vs. Theme.Holo.Light.DarkActionBar)
HoloEverywhere is when you want the Holo theme, um, everywhere :-)
Brett G.
Is AppTheme backwards compatible though?
Mark M.
it depends on what you put in there
Brett G.
I was just using HoloEverywhere because it seemed like the simplest way to get consistent styling between old and new devices
Mark M.
for example, for styling the action bar, you will typically wind up with dual entries, to configure the native action bar or ActionBarSherlock
Brett G.
And they have that nice color scheme artwork generator
Mark M.
again, I'd argue that you don't want consistent styling between old and new devices, if that styling will confuse users
you want to be consistent with user expectations
being consistent with other versions of your app that the user does not see is less important to that user
10:45 AM
Mark M.
Jose: do you have another question?
Brett G.
I have a lot more research to do on the area of styling. I've got about 25 screens in this app and I'm trying to make it easy on my designer :)
Thanks for the advice!
Jose L.
nope, thanks!
Mark M.
OK, if anyone has any questions, chime in
Brett G.
Off to play with AlertDialogs. Thanks again Mark!
11:00 AM
Brett G.
has left the room
Jose L.
well, see you next time Mark!
thanks!
Mark M.
you are very welcome
next chat is tomorrow, 4pm Eastern
have a pleasant day!
Jose L.
has left the room
Mark M.
turned off guest access

Thursday, April 11

 

Office Hours

People in this transcript

  • Brett Golson
  • Jose Luis Montes
  • Mark Murphy
  • Tamir