Office Hours — Today, June 2

Tuesday, May 31

Jun 2
3:50 PM
Mark M.
has entered the room
3:55 PM
Mark M.
turned on guest access
4:00 PM
Chris
has entered the room
Mark M.
howdy, Chris!
Chris
Hey
Man, I'm not prepared at all.
and I'm at work.
Mark M.
um, prepared for what?
Chris
To ask questions
Mark M.
there's no exam at the end of the chat
:-)
Chris
phew
1 sec
4:05 PM
Chris
OK, so I just wanted to have an activity screen and for the summary to be set to the current value of the preference.
View paste
So in my preference activity, in onCreate, I did:
summary = (EditTextPreference) getPreferenceScreen().findPreference("server");
summary.setSummary(prefs.getString("server", ""));
is that ok?
It works, just wanted to see if that's the proper way.
Mark M.
I'd use a different default than the empty string
otherwise, that seems fine
Chris
View paste
Then i registered a sharedpreference listener and 	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
  summary = (EditTextPreference) getPreferenceScreen().findPreference(key);
  summary.setSummary(prefs.getString(key, ""));
}
OK, I can do that.
Mark M.
your second code snippet will be invoked on every preference change, not just the "server" one
if you have more than one preference, this will change the summary of those other preferences as well
Chris
Yep, that's what I want.
Mark M.
oh, OK
Chris
Remember last week when I said that it seemed like my app was only opening one connection then the remaining connections would never reach the server?
Mark M.
I barely remember what I had for breakfast this morning
:-)
Chris
View paste
Well I had
params = new BasicHttpParams();
params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
Mark M.
oh, well, that'll do it
Chris
haha
So I bumped it up to 10 and it works even if I issue repeated commands to the server
4:10 PM
Chris
So I'm not sure what the magic # is or how the client is handling connections.
I was thinking that HttpClient would be like a web browser. I'd have one client open and go to sites repeatedly.
I'm not sure how to like issue a request then close the connection.
Mark M.
having a single HttpClient object is a typical pattern, particularly for helping to deal with session cookies
Chris
Do I need to do a shutdown() after I'm done?
then keep creating a new httpclient for request?
Mark M.
if the server supports Keep-Alive, that will keep a socket open; otherwise, AFAIK, it will shut down right away
Chris
Doesn't seem right.
Mark M.
however, this is really a question for the Apache HttpClient guys, not me
Chris
Hmm... OK
all right
Mark M.
out of curiosity, why are you setting BasicHttpParams in the first place?
Chris
Because I don't know what I'm doing and I found it online :)
I did try to not set it and it wouldn't work at all haha
Mark M.
well, most code I've seen never uses it
then again, most code I've seen may not behave like yours
the default appears to be 20
SyncManager specifically bumps it to 25
Chris
Oh haha
I'll mess with it again. Maybe I did something wrong.
Mark M.
that's the only two references I see in the Android source code
4:15 PM
Mark M.
now, I don't know how many of the other Android apps use HttpClient vs. HttpURLConnection
4:15 PM
Chris
Yeah I'm not even sure of the difference. I did want a google i/o video from last year about REST apps and they said to use HttpClient instead of HttpURLConnection
Mark M.
hehehe
yeah, I saw that too
Chris
But I've gotten the authentication to work and I'm able to manipulate things on the server.
Mark M.
then, in February or March, a Googler popped up on StackOverflow and said the opposite
Chris
Yeah, I imagine a lot can change in a year.
Mark M.
the upshot that I got from I|O this year is that HttpURLConnection has been improved, so it's probably a wash, unless you're using SSL, in which case HttpURLConnection has some benefits
Chris
I am using ssl
Mark M.
let me see if I can find my notes on that...
Chris
Well, I'm faking it now.
Using EasySSLSocketFactory
Mark M.
"HttpsURLConnection now supports TLS intolerance like Chrome. TLS intolerance means it can cope with https servers (and firewalls) out there that reject TLS connections and require a fallback to SSL without compression to handshake at all."
also, you may want to keep tabs on http://stackoverflow.com/questions/5358014…
4:20 PM
Chris
OK
Man I updated my sdk stuff and now my emulator is huge and slow
It used to be about the same size as my phone and was really quick.
Mark M.
well, Android 3.x emulators are WXGA and are glacial, if that's what you mean
NetApex
has entered the room
Mark M.
howdy, NetApex!
NetApex
Hello
Long time no see
Mark M.
was just thinking the same thing
how can I help you today?
NetApex
I haven't had a chance to go through the new books yet (life has been hectic) but I have been playing with the Samsung tablet and now I want to really work on making tablet "aware" apps
How bad are they?
4:25 PM
Mark M.
the books aren't too bad
always room for improvement
or, what did you mean by "they"?
NetApex
Heheh I meant making tablet friendly changes
Mark M.
oh
NetApex
essentially, fragments
Mark M.
depending on the app, fragments may not be necessary to be tablet-friendly (e.g., games)
fragments require a new way of thinking, and some of the advanced effects like you see in Gmail are under-documented
NetApex
I took a look at the IO app and after a bit it seemed to be pretty straight forward as long as you change your way of thinking when it comes activities
Mark M.
bingo
IMHO, if Android was MVC, originally the activity was the C and the widgets were the V
NetApex
I sometimes don't take well to change though lol
Mark M.
now, fragments are the C, widgets are the V, and activities are more of an orchestration layer
major UI events that affect other fragments/activities ripple up from the fragment to the activity
because only the activity knows where the other fragment is (in same activity? in another activity?)
NetApex
ok
Chris
Gotta go, thanks Mark.
Chris
has left the room
NetApex
another question for ya (semi related... all going to the same app at least)
using the endless adapter
4:30 PM
Mark M.
ok
NetApex
I have a couple people with wordpress websites that have a json plugin. Makes it pretty easy to grab the data and toss it into an app...
My issue is trying to pull it with the endless adapter/json and then actually be able to get an onclick working
Mark M.
is it some sort of a "paged" URL scheme?
NetApex
not sure what to reference since I had become so used to using a "tag" as a crutch basically
yes sir
Mark M.
ok
and you rolled your own BaseAdapter to wrap the JSON?
NetApex
correct
actually another friend of mine did and finally helped me figure that part out
Mark M.
and you're wrapping that JSONAdapter in an EndlessAdapter?
NetApex
Trying to at least
I am pretty sure that I am screwing something up there as well
Mark M.
when the user taps the list and onListItemClick() is called, just use the position to get at the particular hunk o' JSON in your adapter
NetApex
I am at work now and had forgotten that you were having the session right now, otherwise I would have my info up right now
4:35 PM
Mark M.
yeah, I try to rotate times, to accommodate various schedules
next evening one is Tuesday
(evening Eastern Time, that is)
NetApex
Ahh that easy? I was assuming it would have to specifically know the hoJ (hunk o'JSON) that was being called
Mark M.
I suppose it depends on what you're using for the JSON parser
if it's org.json.JSONArray, your JSON adapter presumably supports getItem() by accessing the Nth entry in the JSONArray
NetApex
ok
Mark M.
EndlessAdapter does not mess with the position, other than supporting one past your own adapter's getCount()
Julius
has entered the room
Mark M.
so, whatever position you get in onListItemClick() should be good
howdy, Julius!
NetApex
ahh ok cool
That makes things good
Julius
Hiya
4:40 PM
NetApex
The floor is yours Julius
Julius
:) thanks!
I have a question about ant
Mark M.
small insect
Julius
I have a project which is a library and I build multiple versions of the application for different brands
Mark M.
ok
Julius
what I was wondering is whether ant might be the way to go to be able to build all at once
(rather than building each in Eclipse)
Mark M.
sure
fitz
has entered the room
Julius
(PS - I don't know much about ant, but have edited the odd build.xml with vi)
Mark M.
you'd have two main approaches:
in both cases, you just set up the Ant scripts for each non-library project via android project update -p . (where . is the path to the project)
Julius
wow that soudns simple
Mark M.
whether you have the top-level "build 'em all" script be an Ant script itself (option #1) or something else like a batch file/shell script (option #2) is up to you
you probably will have to tweak the default.properties file for each top-level project to reference the library project, per the Android docs
but, again, that's a one-time deal
Julius
cool thank you
Mark M.
most, if not all, of my CWAC projects up on my github repo are set up to build the demo/ app, using the library project, by Ant
I've added a few extra Ant tasks for things like creating JAR files (where relevant)
Julius
(yeah that's what I understood!)
Mark M.
howdy, fitz!
fitz
Hello - Mark you work with Marakana training? looked at there classes and ouch some $'s
4:45 PM
Mark M.
yes, I work with Marakana training, and, yes, it's mostly aimed at corporations
admittedly, not cheap
I've done the occasional thing with a user group, though
a lot of that is Marakana markup
fitz
ya actually saw them through http://www.sfandroid.org/#upcoming
was thinking of going to a meetup they have
Mark M.
yeah, Marakana does a fair bit for the local Android community, particularly downtown SF (vs. the rest of the Valley)
fitz
went last night to Google meetup for GTUG - was good insight to tablet stuff - should we be looking at HTCdev or will all android dev work outside of what HTC does?
Mark M.
well, HTCdev is pretty nascent
as it "sign up and we'll send you an email when we're ready" from what I saw
fitz
ok so not much to concern ourselves with yet
Mark M.
I suspect that they'll be publishing SDK add-ons to get to HTC-specific stuff, like MOTODEV does for MOTOPHONES
4:50 PM
Mark M.
and, with luck, HTC will have their own support boards for HTC-specific issues, akin to the ones run by MOTODEV
4:50 PM
Mark M.
I've had discussions with HTC regarding developer programs -- suffice it to say that this has been in the works for a long while
fitz
ok - not up on motodev - installed in on eclipse a few months back and it got real ugly real fast - maybe again someday when I need it
Mark M.
MOTODEV is the developer program
fitz
for now just still a babe-in-the-woods
Mark M.
MOTODEV Studio for Android is the Eclipse+ADT enhancement package
fitz
ya I have seen it
they have some plgin for eclipse
plugin :)
Mark M.
we're starting to run low on time -- any questions from anyone?
Julius
I have one... :)
Mark M.
go ahead
fitz
ok sorry - will stop babbling
Julius
I was wondering if anyone knew how to add a website as an extra to an intent which is adding a contact
:D
(hope that made sense)
Mark M.
personally, I haven't a clue
haven't really looked
Julius
I'm also having trouble specifying the city too
np - it's probably one of those really specific things
View paste
I was also wondering if it's possible to override class files of a library project in a project that references the library project.
fitz
has left the room
Mark M.
I don't think that's possible
4:55 PM
Mark M.
I think you'll get a duplicate class error at compile time
Julius
I' guessing I'm going to have to do soem kind of branching on my svn server
(of the library)
Mark M.
back to your contacts question
if you are using ACTION_INSERT, it doesn't appear that there's a documented way to add a Web URL
city, in theory, should go somewhere in ContactsContract.Insert.POSTAL
but, again, I haven't tried that
I've only done simple name stuff, in the one Advanced Android sample
Julius
I think I was trying: ContactsContract.CommonDataKinds.StructuredPostal.CITY
no worries
Mark M.
I think that's how you read it out
ContactsContract.Insert is what ACTION_INSERT supports for inbound
NetApex: any last questions?
Julius
(ah!)
NetApex
nnot I
Julius
(thanks for all the help - good to meet you at IO!)
have a good day all!
NetApex
You too
Mark M.
you too!
Julius
has left the room
NetApex
The crowd was just too big for me to catch you there
5:00 PM
Mark M.
yeah, tough to just bump into somebody when you're constantly bumping into somebody
or bumping into robots
NetApex
hehe
alright man, have a good one
Mark M.
anyway, that's a wrap for today
you too!
catch you later!
NetApex
has left the room
Mark M.
turned off guest access

Tuesday, May 31

 

Office Hours

People in this transcript

  • Chris
  • fitz
  • Julius
  • Mark Murphy
  • NetApex