Apr 11 | 9:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Dimitri | has entered the room |
Dimitri |
Hello Mark,
|
Mark M. |
howdy, Dimitri
|
Apr 11 | 10:00 AM |
Mark M. |
how can I help you today?
|
Apr 11 | 10:00 AM |
Dimitri |
I have a question regarding implementation of Viewflipper and Tabhosts.
|
Dimitri |
Can i upload an image i think be quicker to describe what i want exactly...?
|
Mark M. |
sure
|
Mark M. |
try the "Upload a file" link on the right
|
Dimitri | |
Dimitri |
I am developing a application for ferry schedules in greece...
|
Dimitri |
What i would like to do is be able to flip between two sets of tabs ... depicting Oneway and Return journeys...
|
Dimitri |
So basicaly flip the whole image to show the return trips...
|
Mark M. |
that's going to be one fat activity
|
Mark M. |
one ViewFlipper holding two TabHosts holding a total of 14...ListViews?
|
Dimitri |
Exactly which is really getting to complicated for my liking...
|
Apr 11 | 10:05 AM |
Mark M. |
the dates are the same for both sets, right?
|
Dimitri |
nope... the return date might be later...
|
Mark M. |
ah, right
|
Dimitri |
i.e leaves on 05/04 returns on 23/04 has a spam of a week each time
|
Mark M. |
I wish TabHost were more flexible
|
Mark M. |
there's no clean way to change tab indicators once the tabs are created
|
Mark M. |
very frustrating
|
Mark M. |
so, you will probably wind up with two TabHosts anyway
|
Mark M. |
the only question is: is this one activity with a ViewFlipper, or two instances of the "view possible itineraries" activity?
|
Mark M. |
I'd consider going with the latter
|
Dimitri |
this is part of my questuin
|
Dimitri |
Sorry i did not get that, so how would my layout.xml be?
|
Apr 11 | 10:10 AM |
Mark M. |
the activity you show above could be used for either departures or returns
|
Mark M. |
they have the same structure
|
Dimitri |
Yes.
|
Mark M. |
for the purposes of discussion, what's the name of this activity?
|
Dimitri |
TripResults
|
Mark M. |
OK
|
Mark M. |
So, you would have one TripResults activity showing the departures
|
Mark M. |
somewhere (e.g., action bar, options menu), you would have an option to view returns
|
Mark M. |
that would start up another TripResults that views the returns
|
Dimitri |
ah... i see a new activity i was trying to do all in one and kept on getting null pointer...
|
Dimitri |
one more question when i am loading the tabs... as indicated in the image the users input 5/04 is the centered tab...
|
Apr 11 | 10:15 AM |
Dimitri |
What happens however although i set host.setCurrentTabByTag(...) the activity will load the initials tabs data as well?
|
Dimitri |
Is there a way to avoid this...
|
Mark M. |
I do not see where setCurrentTabByTag() would cause this
|
Mark M. |
it probably loads all the tabs when you add them
|
Mark M. |
I am guessing, based on your phrasing, that you are using activities as the contents of the tabs?
|
Dimitri |
In order to fill each tab of the TripResults
activity i am using a TripActivity extending ListActivity to fill the
resulting trips..
|
Dimitri |
Yes its the same activity for each tab..
|
Apr 11 | 10:20 AM |
Mark M. |
yeah, I don't use activities-in-tabs very much
|
Mark M. |
adds overhead for no value, IMHO
|
Dimitri |
Granted i am very new to android this might not be the best approach, but i can seem to find another solution...
|
Mark M. |
Actually, my books focus on the views-in-tabs approach
|
Mark M. |
you will see that in _The Busy Coder's Guide to Android Development_ and _Android Programming Tutorials_
|
fitz | has entered the room |
Mark M. |
howdy, fitz!
|
fitz |
morning just getting started today so no questions
|
Mark M. |
you don't want me to ask you any questions in the morning?
|
Mark M. |
oh, no, wait, that's a question...
|
Mark M. |
:-)
|
fitz |
na that is my status - your well into your morning - past coffee time
|
Apr 11 | 10:25 AM |
Mark M. |
well, if anyone has a question, chime in
|
fitz |
I noticed through some emails that your planning to do section on voice recognition - huge need for this?
|
Mark M. |
I don't think it's super-popular
|
Mark M. |
which is one of the reasons it's on the back burner
|
Apr 11 | 10:30 AM |
Mark M. |
my focus tends to be either on itches of my own that I am scratching, or itches that I think a lot of developers have
|
Mark M. |
hence, I'd rather focus on memory management and Honeycomb and stuff now than voice recognition
|
Mark M. |
not that voice recognition is bad, hard, or anything -- it's just not as critical for as many people
|
fitz |
ya not main stream yet
|
Dimitri |
If i was to implement a solution using the
views-in-tabs approach how exactly would I load only the data require
in each view. I.e http request per tab?
|
Apr 11 | 10:35 AM |
Mark M. |
put a ListView in each tab, but do not set an adapter right away
|
Mark M. |
register an OnTabChangeListener with the TabHost
|
Mark M. |
when the tab becomes active, you then know to load your data
|
Dimitri |
using an intent to TripActivity...
|
Mark M. |
well, if TripActivity used to be what were in the tabs, there would be no TripActivity if you switch to views-in-tabs
|
Dimitri |
Again it would be 7 lists view in the tabhost correct?
|
Mark M. |
yes
|
Apr 11 | 10:45 AM |
Dimitri |
I would have to call spec.setContent(R.id.list{id}); in each case?
|
Mark M. |
yes
|
Mark M. |
or, if you prefer, you could not have the ListViews in the XML and use a TabContentFactory
|
Mark M. |
what would be nice here is an equivalent of the
old VB TabStrip control, which gave you tab buttons but made no
assumptions about what happened on a tab button press
|
Mark M. |
in that case, you would use a single ListView and change up the adapter on a tab change
|
Mark M. |
I have not tried using TabWidget this way, but I suspect it will only work with a TabHost
|
Apr 11 | 10:50 AM |
Dimitri |
How anout a custom Viewflipper instead?
|
Mark M. |
I don't know how that would help
|
Dimitri |
Thanks for your time as always valuable info i will have to read up on what we discussed.
|
fitz |
do you think it is best to have logic and time set
aside to re-do an app just for tablets - so can most code work with
tweeks - I guess what I am asking if if apps now should be only for
cells and then start from scratch for tablets and market it that way?
|
Mark M. |
that's difficult to answer in the abstract
|
Mark M. |
the problem with "start from scratch for tablets" is that tablets will be able to get at your phone edition
|
fitz |
talking business apps not games etc.
|
Mark M. |
though you can try the new <compatible-screens> element to try to keep tablet users from seeing the phone apps
|
Apr 11 | 10:55 AM |
Mark M. |
the only way, IMHO, it's clearly desirable to have
a separate tablet-only app is if that's your sales model (e.g., phone
app is free, tablet app with more features costs $$$)
|
Mark M. |
otherwise, I'd try to have one app supporting all form factors
|
Mark M. |
in theory, fragments and the Android Compatibility Library will help here
|
Mark M. |
after my weekend of fighting with fragments, the acronym of ACL for that library seems apropos -- in other words, ow.
|
fitz |
ok thanks for info will ponder ...... till next time have a GREAT day
|
Mark M. |
you too!
|
fitz | has left the room |
Apr 11 | 11:00 AM |
Mark M. |
OK, today's chat is over
|
Mark M. |
next one is Thursday at 4pm Eastern Time
|
Mark M. |
have a pleasant day!
|
Dimitri | has left the room |
Mark M. | turned off guest access |