Dec 20 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Alex B. | has entered the room |
Alex B. |
Hi Mark
|
Mark M. |
howdy, Alex!
|
Mark M. |
how can I help you today?
|
Alex B. |
so I'm working on this app with multiple activities
|
Alex B. |
now I want to create a sort of parent navigation
activity which keeps track of state mostly, but also has some
convenience methods
|
Dec 20 | 7:30 PM |
Mark M. |
what do you mean by "parent"?
|
Alex B. |
what's the best strategy to do that?
|
Mark M. |
do you mean a superclass?
|
Alex B. |
yea
|
Alex B. |
but the problem is my superclass would have to inherit off Activity
|
Mark M. |
correct
|
Mark M. |
or whatever other base class you are presently using (e.g., FragmentActivity)
|
Alex B. |
and if I want to use a MapActivity, I can't use that superclass
|
Mark M. |
correct
|
Alex B. |
which is a problem since I want to use both fragments and maps :)
|
Mark M. |
that is not presently possible, if you are using the Android Support package
|
Mark M. |
leastways, you can't put a MapView in a fragment
|
Alex B. |
I am using the support package
|
Mark M. |
because MapActivity does not inherit from FragmentActivity
|
Alex B. |
I understand that, they would be different activities
|
Charlie | has entered the room |
Mark M. |
then you probably do not want to "create a sort of parent navigation activity"
|
Alex B. |
which is why I'm here
|
Mark M. |
use composition instead of inheritance
|
Mark M. |
(BTW, howdy, Charlie!)
|
Alex B. |
for example I'm listening for screen off events
|
Charlie |
Hi. First time here.
|
Alex B. |
in all my activities
|
Alex B. |
and creating the same menu in all my activities
|
Mark M. |
put those hunks of code in static methods, then
|
Mark M. |
where you pass in an Activity as a parameter
|
Mark M. |
you would still need to override onPrepareOptionsMenu(), etc. in the activities
|
Mark M. |
and you might elect to create a thin base Activity class that handles those overrides
|
Dec 20 | 7:35 PM |
Mark M. |
but, by putting most of the logic elsewhere,
copying those handful of callback methods into your MapActivity will not
be as big of a deal
|
Alex B. |
I see
|
Mark M. |
and, while you're doing all of this, wish that the core Android team had chosen Ruby instead of Java :-)
|
Alex B. |
ruby has multiple inheritance?
|
Mark M. |
Ruby has mixins
|
Mark M. |
gives you much of the effect of multiple inheritance
|
Alex B. |
interesting, never got that deep into ruby
|
Mark M. |
fun language
|
Mark M. |
it's what I use when I'm not doing Android stuff
|
Mark M. |
let's swing over to Charlie
|
Mark M. |
Charlie: do you have a question?
|
Alex B. |
sure
|
Charlie |
Have the need to enter time information into a form in mm:ss format
|
Charlie |
Boils down to TextWatcher vs. some sort of time picker
|
Charlie |
The time will be entered into a form that is part
of an alert dialog. Any issues with launching another dialog like a time
picker from that?
|
Mark M. |
I've never tried it, and it would scare the heck out of me
|
Mark M. |
why the AlertDialog in the first place?
|
Dec 20 | 7:40 PM |
Charlie |
The app puts together a list of songs. I looked
into launching another activity for a new song ( ala NotePad demo) vs.
using a dialog to enter the song info.
|
Mark M. |
generally speaking, avoid dialogs
|
Mark M. |
they limit the user's flexibility in navigation
|
Mark M. |
the more complex the thing in the dialog, the less likely it is that it should be in a dialog in the first place
|
Charlie |
good point.
|
Mark M. |
heck, even the name/value dialog in my ConstantsBrowser sample, with two whole fields, is a bit more than I'd ordinarily do
|
Charlie |
See the dialogs alot with tablets though.
|
Charlie |
Changing to a full screen activity might be too much.
|
Charlie |
Then there's fragments...
|
Mark M. |
with tablets, using a dialog suggests an underlying navigation issue
|
Mark M. |
I agree that popping a whole 'nuther activity would be overkill
|
Charlie |
I played around with TextWatcher a bit for the number entry.
|
Dec 20 | 7:45 PM |
Charlie |
Are you familiar with the PhoneNumberFormattingTextWatcher?
|
Mark M. |
not particularly
|
Mark M. |
I'm allergic to long class names :-)
|
Alex B. |
then you must love objective-c heh
|
Mark M. |
never touch the stuff
|
Mark M. |
there's a language that should have died back in the mid 1990's
|
Mark M. |
anyway, I take it you want to create an MinutesSecondsFormattingTextWatcher?
|
Charlie |
It allows user to enter a phone number and automatically puts in dashes
|
Charlie |
I was going to modify it to use for mm:ss time entry but it might be more confusing for the user.
|
Charlie |
View paste
|
Mark M. |
if you are going to stick with the dialog for the
form, and you don't have room for a pair of NumberPicker widgets, your
TextWatcher is about the best you can do
|
Mark M. |
if you switch away from the dialog to an activity, rolling a MinutesSecondsPicker, based on TimePicker, should be doable
|
Mark M. |
but I'd be nervous about popping a dialog from a dialog
|
Charlie |
Yes, it seems to work in the quick hack but I'm concerned other issues might creep up.
|
Dec 20 | 7:50 PM |
Mark M. |
issues tend to do that
|
Mark M. |
wish we could tie bells on 'em
|
Charlie |
I'm thinking of using the DateSlider widget
|
Charlie | |
Mark M. |
that's sexy
|
Mark M. |
not sure how easy it would be to modif
|
Mark M. |
er, modify
|
Charlie |
Its got what I need.
|
Charlie |
But has one annoying quirk. Both wheels turn
|
Mark M. |
OK
|
Alex B. |
another question, I was making a widget for google
tv devices, for the preferences activity, I'd like to use the built in
preference stuff, but how do I "save" them if I use a preference
activity
|
Mark M. |
Alex: PreferenceActivity automatically persists preference changes
|
Alex B. |
so the only way for users to exit that is to press back
|
Mark M. |
to exit a PreferenceActivity, the user presses BACK, or HOME, etc.
|
Alex B. |
so for an update frequency preference (update every x minutes) I was using a text edit box for testing
|
Dec 20 | 7:55 PM |
Mark M. |
you mean an EditTextPreference?
|
Mark M. |
or your own activity with an EditText?
|
Alex B. |
is there a page though the google docs which shows all the possible preference types?
|
Alex B. |
my own activity with an edit text
|
Mark M. |
look at the JavaDocs for android.preference.Preference
|
Mark M. |
and look at the subclasses
|
Alex B. |
I was wondering about a visual index, to see how they look as well :)
|
Mark M. |
oh
|
Mark M. |
not that I am aware of
|
Alex B. |
they should make something like that, the way they did for the "hello views" page
|
Mark M. |
they don't even really maintain "hello views" all that well
|
Alex B. |
that's true
|
Mark M. |
it's certainly a need, but I wouldn't hold my breath
|
Alex B. |
so what do you think of the google tv?
|
Charlie |
The same app I'm discussing re: time picker will
need have the capability to reorder a list of songs. Then save the
reorder in database.
|
Mark M. |
Charlie: TouchListView could handle that
|
Mark M. | |
Mark M. |
Alex: I watch so little TV, that the notion of running apps on a TV just isn't a use case for me personally
|
Mark M. |
professionally, it's intriguing, and I have a chapter coming out on it in a week or two
|
Charlie |
Yes. But concerned about how to update the database. There is a stackoverflow question about this that I need to dig into.
|
Alex B. |
ah nice
|
Alex B. |
which book is it going to be in?
|
Dec 20 | 8:00 PM |
Charlie |
Paul Carf from Google is speaking about Google TV at a meetup here in CA tomorrow.
|
Mark M. |
Charlie: I'm assuming your database has some sort
of sequence number column that you would need to update, in a bunch of
UPDATE statements, in a tranasction
|
Mark M. |
Alex: The Busy Coder's Guide to Advanced Android Development
|
Alex B. |
makes sense
|
Alex B. |
yea, I wish they'd put more of the talks videos online
|
Alex B. |
like the ones from AndDevCon ||
|
Charlie |
Mark I think you suggested two approaches to the touchlistview database issue. Trying to find the question on stackoverflow.
|
Mark M. |
it's possible -- I don't remember the question,
and, well, I've answered enough that finding a specific one of mine is a
wee bit challenging
|
Charlie |
I think one of the suggestions was using an array and doing the sort there before updating the db
|
Mark M. |
oh
|
Dec 20 | 8:05 PM |
Mark M. |
TouchListView needs a mutable adapter, like an ArrayAdapter on an ArrayList
|
Mark M. |
so, you can't really use it directly with a CursorAdapter
|
Mark M. |
the two approaches were:
|
Mark M. |
1. schlep the data from the Cursor into an ArrayList and use an ArrayAdapter
|
Mark M. |
2. create a ReorderingCursorAdapter that maintains
its own internal sequence information and maps everything from list
positions to their corresponding current positions in the Cursor
|
Mark M. |
the plus side of #2 is that it would be faster at runtime and generate less garbage
|
Charlie |
Option 1 sounds easier
|
Mark M. |
the minus side of #2 is that #1 is easier :-)
|
Charlie |
The list that needs to be sorted won't be too long, about 10 to 15 items
|
Mark M. |
that won't take long to convert into an ArrayList, then
|
Alex B. |
Mark are the chat logs for the office hours available online?
|
Charlie |
Thanks for the additional info. I'll dive into the list sorting after I get the time picker worked out.
|
Mark M. |
Alex: I email a link to the transcript to the cw-android Google Group, for any chat with a meaningful transcript
|
Dec 20 | 8:10 PM |
Mark M. |
I don't have an RSS/Atom feed for them at this time
|
Mark M. |
nor a centralized archive page
|
Mark M. |
as I am laaaaaaaaaaaaaaaaaaaaaaazy
|
Alex B. |
ok
|
Alex B. |
heh, I thought campfire might offer that sort of functionality
|
Mark M. |
not publicly visible
|
Mark M. |
I can see them
|
Mark M. |
but I don't see where I can make that something that anyone can access
|
Mark M. |
though it's been ages since I looked, so I'll check again
|
Alex B. |
I remember I searched for something on google once and it took me to a chat transcript of one of your office hours
|
Charlie |
Alex, that's rare
|
Alex B. |
yea, I wish I'd have saved it
|
Charlie |
I rarely get hits on the google group. Stack Overflow usually dominates the search results
|
Alex B. |
well that's all for me tonight guys
|
Alex B. |
have a good one
|
Mark M. |
see ya!
|
Charlie |
What are your thoughts on NFC's adoption in US?
|
Alex B. | has left the room |
Mark M. |
well, the NFC, having won the last two Super Bowls, is fairly popular
|
Mark M. |
oh, no, wait
|
Mark M. |
you aren't talking about football
|
Charlie |
Yes, probably again this year
|
Charlie |
no.
|
Mark M. |
right now, there are too few devices
|
Dec 20 | 8:15 PM |
Charlie |
I attended the WIMA conference in san franscisco earlier this month
|
Dec 20 | 8:15 PM |
Mark M. |
including precisely zero from a certain fruit-flavored device category
|
Charlie |
The head of the NFC forum had the same joke!
|
Mark M. |
heh
|
Mark M. |
even if 100% of new Android phones shipped with NFC, it would take a long time for critical mass to be achieved
|
Mark M. |
and 100% of new Android phones will not have NFC, as I understand it
|
Mark M. |
so, it's the sort of thing that has interesting long-term potential
|
Charlie |
Yes, the 2 year contracts on the phones slows things down.
|
Charlie |
Hard to tell if the indie developer will have a shot at a piece of the pie.
|
Mark M. |
which pie?
|
Charlie |
all the potential revenues from NFC
|
Charlie |
the banks will get all the payment $
|
Mark M. |
:: shrug ::
|
Charlie |
Developers may have a shot at non-payment revenue.
|
Mark M. |
that's like asking who is getting all the potential revenues from cameras
|
Charlie |
Have you tested NFC with more than one NFC app on your phone?
|
Mark M. |
yes
|
Mark M. |
had a couple of existing NFC apps plus my one sample
|
Mark M. |
haven't done a ton with it outside of the sample, but I don't know where I'd encounter an NFC tag
|
Charlie |
It kind defeats the no tap that google touts
|
Mark M. |
now that my Nexus S has the ICS upgrade, I need to play around with Android Beam
|
Charlie |
You have to select which app to read the tag. Which results in a tap
|
Charlie |
How did you get ICS on the Nexus S?
|
Mark M. |
OTA update happened... yesterday? day before?
|
Dec 20 | 8:20 PM |
Mark M. |
regarding the tag and taps, that depends on how you set up the tag and filters
|
Mark M. |
preference is given to more specific matches
|
Charlie |
I haven't turned mine on in a few days. Thanks for the heads up.
|
Mark M. |
yeah, I don't know how the OTA rollout is happening
|
Charlie |
So I may be able to disable another app and pick the one that I want to read?
|
Mark M. |
also, mine is a T-Mo Nexus S, not a Sprint one, and I think that matters
|
Mark M. |
not so much "disable" as "have a tag that targets your app better"
|
Mark M. |
for example, take a tag with a URL encoded on it of http://commonsware.com/nfctest
|
Mark M. |
an app that says "I handle NFC tags where the URL is http://commonsware.com/nfctest"; will be invoked with no chooser
|
Mark M. |
even though other apps on there say "I handle NFC tags that have anything on them"
|
Charlie |
Great. Thats what I was hoping for.
|
Mark M. |
so, I think it is a matter of choosing a tag structure and <intent-filter> combination that works right
|
Charlie |
I have the NXP app and a couple of others installed that all come up in the chooser.
|
Mark M. |
for example, a tag with a vCard should pop all apps that are NFC-aware and deal with contacts, but not arbitrary NFC stuff
|
Mark M. |
right
|
Mark M. |
again, it depends a bit on the tag and the <intent-filter>
|
Mark M. |
over time, we'll work out all the rules and patterns to follow
|
Charlie |
Ok. Thanks for the great info. Have to get rolling now. happy holidays.
|
Mark M. |
you too!
|
Charlie | has left the room |
Dec 20 | 8:30 PM |
Mark M. | turned off guest access |