Office Hours — Today, June 22

Thursday, June 17

Mark M.
has entered the room
Mark M.
turned on guest access
Jun 22
8:00 PM
Julius
has entered the room
Julius
hi
Mark M.
howdy, Julius!
Julius
just have a quick (hopefully) question
Mark M.
go right ahead!
Julius
I'm getting an ANR and not quite sure why although I know the lone
line
so I'm doing this:
8:05 PM
Julius
View paste
		Document doc = builder.parse(new org.xml.sax.InputSource(reader));
thet way I have done this is I have a Service
Ron B.
has entered the room
Julius
and the Service runs a Thread
and the Service updates Activities based on what's happening
Mark M.
OK
(btw, howdy, Ron!)
Julius
so the interface is responsive
it's not like it's stopping
but occasionaly I get an ANR
Ron B.
Hi Mark
Mark M.
ANR dialog?
Julius
one thing I can control is potentially to parse a smaller amount of xml
but I figure maybe there's a better way
ah yes
Mark M.
on what thread are you parsing the XML?
Julius
one that I have started in the Service
Mark M.
then it is not the cause of your ANR, at least not directly
ANRs are purely from work done on the main application thread
Julius
oh
so it's just running at the same time perhaps
(why I'm seeing it mentioned in the traces.txt)
Mark M.
most likely
BTW, any reason you're forking your own Thread, versus using an AsyncTask?
Julius
I've had a play with the TraceViewer
oh
no I'm not familiar with AsyncTask...
8:10 PM
Mark M.
android.os.AsyncTask
Julius
:)
ok I'll check it out
Mark M.
covered in the Threads chapter in The Busy Coder's Guide to Android Development
Ron B.
Hi Mark,Should be a quick one. I'm trying to set a required time for a user touch to activate a button or list element. Say 10 seconds before calling 911 so it doesn't go off accidentally. Wh
Julius
ah ok I'll check that out
Mark M.
great for parsing jobs and stuff like that
Julius
ok thanks
Ron B.
Sorry, hit send too early
Julius
hi Ron, will let you ask :)
np
bfn
thank you Mark!
Mark M.
Julius: happy to help!
Ron B.: want to try that question again?
Ron B.
Hi Mark,Should be a quick one. I'm trying to set a required time for a user touch to activate a button or list element. Say 10 seconds before calling 911 so it doesn't go off accidentally. Where would I find the setting to make that happen?
Julius
has left the room
Mark M.
Setting?
let's back up a step
what do you mean by "required time for a user touch to activate a button or list element"?
Ron B.
Well, a class or method, etc.
I know how to make a call programmatically. I want it to happen when the user presses an emergency key.
Mark M.
what do you mean by "required time for a user touch to activate a button or list element"?
8:15 PM
Ron B.
I don't want the call to go off by accident, since it's a 911 call. So I want the user to press and hold for 10 seconds or so before the call is made.
8:15 PM
Mark M.
If you're trying to change the time it takes for onClick() to react, I doubt that is possible.
Certainly, I don't know where to change it
you'd want to look at onTouchEvent() and handle it at a lower level
perhaps not using a true Button, but an ImageView or something
Ron B.
OK, thanks!
Mark M.
any other questions?
Ron B.
Not from me, have a good evening
Mark M.
you too!
Ron B.
has left the room
8:20 PM
JonnyG
has entered the room
Mark M.
howdy, Jonny!
JonnyG
Heya Mark.
been trying to catch one of these chats, but foiled by the time zones!
Mark M.
sorry
normally, they are Tuesday evening and Thursday morning, US Eastern
varies sometimes based on my schedule
JonnyG
No worries. Should've checked first. Good to know.
Mark M.
how can I help you?
JonnyG
I just started Android development - disgruntled iPhone dev - and your books have been a great help so far...
Mark M.
glad to hear they're useful!
JonnyG
I'm just starting to read about animations and how to apply them to views
Mark M.
wow, diving into the deep end early
:-)
JonnyG
and I've played around with layout animation controllers in a GridView and ListView
8:25 PM
JonnyG
but, what I'm trying to do is animate only the addition of new data to my Adapters, if that makes sense, and I'm hoping you can point me in the right direction for where to be dealing with this code
Mark M.
that is so much in the deep end, you've made your own pool
JonnyG
hah! i bet
Mark M.
I would have absolutely no idea where to begin on that
animation of simple views and containers (as a whole) is as far as I've gone
the concept of animating the addition of something to an AdapterView...I suppose it's possible, but I don't have the slightest idea how to approach it
JonnyG
ok, well that's lower on my list of things to tackle, so I'll keep plowing through. Not even necessary for my app. Just a nice little bit of sheen.
Mark M.
yeah, I can imagine the effect would be rather striking, done right
8:30 PM
JonnyG
i think i have a couple more questions for you, if I can figure out how to ask them =)
Mark M.
anything else I can try to help you with?
take your time -- as you can see, it's a quiet night in the chat
two others were here, got answers, and departed
JonnyG
I'm using your SimpleWebCache to load images from the web and I'm finding that, depending on the host, the loading can hang forever. I've pulled the source for SimpleWebCache into my project and modified it to be able to set a configurable ConnectionTimeout and ReadTimeout. A) Can you think of any problems that could arise from setting these timeouts and B) are there any Android "System" properties that I can set to achieve this without either modifying source or extending the SimpleWebCache?
Mark M.
A) If they work for you, they should be OK
B) No, sorry
C) SimpleWebCache is a nasty piece of code that I need to rewrite someday
8:35 PM
JonnyG
one of the things I'm looking at is to have a different AsyncTask (or AsyncTaskEx) for reading the images from either level of the cache and having a different one for loading from the Web. I'm still trying to figure out exactly what AsyncEx is doing.
because the web loading is holding up loading from cache (i've got a bunch of thumbnails on the screen at once)
but, i haven't really dove in that far yet to see what's happening
Mark M.
AsyncTaskEx was there to deal with the fact that AsyncTask originally only handled one operation at a time and could not handle a queue of more than 10 pending tasks
newer versions of AsyncTask are better
if you are only supporting Android 2.x, you probably do not need AsyncTaskEx
JonnyG
ah, ok, gotcha. I'm shooting for 1.5 or 1.6, but that may change. I've certainly found other things I want from 2.x.
8:40 PM
JonnyG
alright, well, I think I'll go play around in AsyncTask land and try and crack that nut. Thanks for your time, Mark, and the great books!
Mark M.
you're very welcome!
JonnyG
night!
JonnyG
has left the room
8:45 PM
Mark J.
has entered the room
Mark J.
Heya Mark
I couldn't leave you here alone! :)
Mark M.
howdy, Mark!
actually, three others were here and gone earlier
how can I help you?
Mark J.
Well, I am just somewhat here to chat, and somewhat here for questions
If nobody else is here
Mark M.
well, the floor is yours
Mark J.
Well, just wanted to say, nice job! I walked into a Barnes & Noble today and saw all of your Android books :)
Mark M.
All?
8:50 PM
Mark M.
more than _Beginning Android 2_?
8:50 PM
Mark J.
Maybe not All, But I saw 2? Maybe 3?
Mark M.
the ones with the CommonsWare imprint aren't usually carried in bricks-and-mortar bookstores
mostly because I don't accept returns
hence, I'm surprised if you saw more than the Apress _Beginning Android 2_ on the shelf
Mark J.
They weren't the ones here at commonware. But they were from Apress
Mark M.
well, I did _Beginning Android_, replaced by _Beginning Android 2_
both of which are Apress' branded version of _The Busy Coder's Guide to Android Development_
Mark J.
Ahh, yes. Just a link to the store, and where I found them
Mark M.
ah, online they're available
most online bookstores carry them
just not the kind you walk into
Mark J.
Though, I guess I only saw the Beginning Android and Beginning Android 2 were the ones I saw
Well, before your time runs up I do have a quick question
Mark M.
go ahead!
8:55 PM
Mark J.
I am looking for an easy way to background an RSS reader before it displays the info. My current work has it so that the application is frozen the entire time until it has finished retrieving the content
Do you know of somewhere I can read up on this
Mark M.
uh, well, what exactly do you mean by "background an RSS reader"?
Mark J.
I want the downloading of the content to happen in the background while my UI is still operating
As it is now, the application "Halts" while it waits for the content
Mark M.
OK
Mark J.
Did I explain enough?
Mark M.
first, you're going to need to move the fetching and parsing off the main application thread
Mark J.
Okay
Mark M.
to do that, you can use AsyncTask, covered in the Threads chapter of The Busy Coder's Guide to Android Development
your choice then is whether to have your reader activity do the task, or have it managed by a service
Mark J.
Sweet, is pretty much everything I need covered in that chapter?
Mark M.
if you have the activity do it, you will need to think about orientation changes -- there's a new section on this in the latest edition of The Busy Coder's Guide to Android Development
Mark J.
As far as the threads?
Mark M.
yes
if you want to have a service do it, that's covered in the services chapter of The Busy Coder's Guide to Android Development
Mark J.
Alright I will take a look at both of them later this evening
9:00 PM
Mark J.
Well, from now on, I will attempt to hop in here every session and at least chat and ask questions
To help out the crowd :)
Mark M.
hey, last week in this time slot, I had 8 people
actually a bit difficult to get everyone's questions answered
so, it comes and goes
you're certainly welcome to swing by, but it's rarely lonely for an extended period
Mark J.
Sweet :) I will try and make every single one, I love that you added the schedule to Google Calendar
Mark M.
yeah, I don't schedule too far in advance, in case of travel changes
I usually try to keep two chats outstanding
for example, I just updated the schedule for next Tuesday's chat -- oddball time, courtesy of a training event in Portugal
Mark J.
Ahh alrighty
One last question for you
Is all of the work you do related to Android?
Mark M.
Well, I vacuum the condo from time to time
:-)
Mark J.
:-) Sometimes you have to!
Mark M.
I do development in Ruby on some side projects
9:05 PM
Mark M.
primary focus nowadays is Android
more than enough to keep me busy
anyway, that's all for this evening's chat
Mark J.
Okay, well if your time is coming to an end, you may end the chat. Though I will be here next time to hang out, and ask questions if anything comes around
Have a good evening Mark
Mark M.
thanks, and have a pleasant evening!
Mark J.
has left the room
Mark M.
turned off guest access

Thursday, June 17

 

Office Hours

People in this transcript

  • JonnyG
  • Julius
  • Mark Johnston
  • Mark Murphy
  • Ron Bruckman