Apr 26 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Julius | has entered the room |
Mark M. |
howdy, Julius!
|
Julius |
Hello
|
Julius |
how are you today?
|
Mark M. |
OK, and you?
|
Julius |
good - just awake :)
|
Julius |
still hoping to bump into you at IO
|
Mark M. |
well, I should be there
|
Mark M. |
along with thousands of others
|
Julius |
:)
|
Julius |
I was wondering if you had any advice on applying a font to TextViews throughout an application
|
Julius |
(once marketing guys get hold of an app... :)
|
Mark M. |
there's no good way to do it
|
Mark M. |
you have to do it in Java code
|
Mark M. |
neither layout XML nor styles/themes help here
|
Apr 26 | 4:00 PM |
Mark M. |
very annoying
|
Mark M. |
you could write yourself a utility method that
walks a View's children, identifies those that inherit from TextView,
and updates the typeface
|
Mark M. |
but you'd need to remember to apply that everywhere (each activity, each row in a ListView, etc.)
|
Julius | |
Julius |
(bugger)
|
Mark M. |
ah
|
Julius |
I recently did all the EditText's styles which was great
|
Mark M. |
I was trying to determine the connection there
|
Mark M. |
yeah, I have no idea why they haven't done something in the XML for this
|
Julius |
err modifie dthe style and that was great
|
Julius |
across the whole app was really nice
|
Julius |
hmm cool
|
Mark M. |
another possibility is that you can read in the
layout XML files yourself and add your own attributes that point you to
font files touse
|
Julius |
just checking I couldn't do it easily
|
Mark M. |
er, to use
|
Mark M. |
and please read the Fonts chapter in The Busy Coder's Guide to Android Development, particularly the part about ellipsize
|
Julius |
oh right ok
|
Mark M. |
I just answered a StackOverflow question pertaining to that issue
|
Julius |
yeah I wondered whether ellipsize slows down list scrolling
|
Ahmet | has entered the room |
Julius |
that's just a total aside
|
Mark M. |
I doubt that it speeds it up :-)
|
Mark M. |
howdy, Ahmet!
|
Julius |
thanks I'll look into that chapter
|
Mark M. |
Ahmet: do you have a question?
|
Ahmet |
I am good, thanks how about you?
|
Ahmet |
yes
|
Don | has entered the room |
Ahmet |
I have a general question
|
Don |
Hi everyone
|
fitz | has entered the room |
Mark M. |
Ahmet: go ahead
|
Mark M. |
(btw, howdy, Don and fitz!)
|
Ahmet |
whats the best way to handle runtime changes on certain conditions?
|
Apr 26 | 4:05 PM |
fitz |
hello - observing today :)
|
Mark M. |
I do not know what you mean by "runtime changes on certain conditions"
|
Mark M. |
(fitz: if you were observing tomorrow, I'd ask what the lottery numbers were going to be)
|
Ahmet |
for example, screen rotation or a phone call
|
Mark M. |
Ahmet: those are fairly distinct events
|
Ahmet |
a phone call is not considered as a runtime change?
|
Ahmet |
right
|
Mark M. |
you're the one coming up with the "runtime change" term, not I
|
fitz |
go with #'s that end in 1 and 2's
|
Mark M. |
a screen rotation is a configuration change
|
Mark M. |
you handle it via onSaveInstanceState() and onRetainNonConfigurationInstance(), except in relatively unusual circumstances
|
Julius |
(I'm observing tomorrow)
|
Mark M. |
there's a chapter in The Busy Coder's Guide to Android Development on rotation
|
Mark M. |
a phone call is simply the current activity being paused and stopped
|
Mark M. |
it might be destroyed eventually, if the user does not come back for a long time
|
Mark M. |
you can get control in onPause(), onStop(), and onDestroy() to do whatever bookkeeping you want
|
Mark M. |
that's covered in the activity lifecycle chapter of The Busy Coder's Guide to Android Development
|
Don |
I have a question when Ahmet is finished.
|
Ahmet |
thanks but is it onpause/onresume or onstop/oncreate? or should we do it in both?
|
Apr 26 | 4:10 PM |
Mark M. |
the counterpart to onStop() is onStart(), not onCreate()
|
Mark M. |
the difference between onStop/onStart and onPause/onResume is relatively obscure, so you can use whichever pair you wish
|
Ahmet |
ok onstop/onstart.
|
Mark M. |
more often, people use onPause/onResume
|
Mark M. |
let me take some questions from others, and then I will cycle back around to you
|
Ahmet |
ok
|
fitz | has left the room |
Mark M. |
Don: fire away!
|
fitz | has entered the room |
Don |
I get errors when trying to compile EU4You_6. Anything having to do with the ACL produces an error.
|
Mark M. |
what sort of error?
|
Don |
View paste
|
Mark M. |
you need to have the ACL JAR in libs/ and, if you're using Eclipse, in your build path
|
Don |
That is probably the culprit. But I'm getting over 100 errors.
|
Don |
I have the ACL jar
|
Mark M. |
the compiler does not think so
|
Apr 26 | 4:15 PM |
Don |
View paste
|
Mark M. |
are you compiling with Ant or Eclipse?
|
Don |
Eclipse
|
Mark M. |
did you add it to your build path in Eclipse?
|
Don |
No. Where is that done?
|
Mark M. |
Project properties
|
Mark M. |
in the Build Path area, there's a Libraries tab IIRC
|
Mark M. |
on there, there's an Add JAR button
|
Mark M. |
that will bring up a dialog to allow you to navigate the files in your project and find the JAR
|
Julius |
(select project, Alt Enter => Java Build Path => Libraries tab => Add External Jars...
|
Mark M. |
I wouldn't use Add External JARs
|
Julius |
oh... :)
|
Mark M. |
Add JAR is what I have my students use, and it seems to work
|
Julius |
oh
|
Julius |
what's the difference?
|
Mark M. |
I seem to recall problems with Add External JAR when the JAR is in your libs/
|
Julius |
oh I see
|
Mark M. |
IIRC, Add External JAR lets you browse the whole filesystem
|
Julius |
I haven't had any issues, but good to learn soething new
|
Mark M. |
there used to be a problem
|
Mark M. |
might be cleared up now
|
Julius |
oh right yeah I tend to share libs across projects
|
Apr 26 | 4:20 PM |
Julius |
especially the cwac ones
|
Julius |
:)
|
Julius |
(sorry to butt in)
|
Don |
That got rid of some of the errors. Specifically the ones having to do with Fragments.
|
Don |
But, I'm getting a lot of
|
Don |
View paste
|
Mark M. |
Project | Clean from the main menu
|
Mark M. |
and if that does not help, check your console for resource-related problems
|
Don |
Didn't help. No entries in Concole
|
Mark M. |
Can't help you much
|
Mark M. |
R is automatically generated
|
Don |
ok, I know about R. Will Google for it.
|
Mark M. |
you will need to figure out why it is being generated in the wrong package or what is blocking it from being generated
|
Mark M. |
I'll swing back to you in a bit
|
Mark M. |
fitz: the "better medium" (per your email) *is* office hours, or StackOverflow, or the android-developers Google Group
|
AngelOD | has entered the room |
Mark M. |
I have examples of using ContactsContract and multiple columns in The Busy Coder's Guide to Advanced Android Development
|
Apr 26 | 4:25 PM |
Mark M. |
howdy, AngelOD!
|
fitz |
Mark quick one - NFC only works when 4CM away from
each other - is this correct? so what process would be best for
devices 2-3-5 feet away?
|
AngelOD |
Greetings :)
|
Mark M. |
fitz: I don't know the range for NFC
|
Mark M. |
Bluetooth is good for 2-3-5 feet away
|
navjeet | has entered the room |
Mark M. |
or possibly NFC and a Pringles can
|
Mark M. |
:-)
|
fitz |
great will lok at advanced book again - any page or section?
|
Mark M. |
there's a chapter on contacts
|
fitz |
ok
|
fitz |
thanks
|
Mark M. |
Chapter 17, to be precise
|
Mark M. |
howdy, navjeet!
|
Mark M. |
AngelOD: do you have a question?
|
navjeet |
what is best way to subscribe/watch for bluetooth paring events?
|
navjeet |
pairing
|
AngelOD |
I do, yes. Shall start typing it out. :)
|
Mark M. |
navjeet: beats me, I have not done much with Bluetooth
|
Mark M. |
navjeet: I try to take questions one at a time, so
I'll be back to you again for an additional question in a bit, once I
give others a turn
|
Don | has left the room |
navjeet |
ok
|
Mark M. |
AngelOD: go ahead
|
AngelOD |
I've been experimenting a bit with services and
broadcast events and such, and I know how to make it start up with the
device, but I'm wondering how to best handle the case of installing and
updating, and ensuring that the broadcast is registered without having
to reboot the device, as well as ensuring it isn't registered multiple
times (as I understand that's actually possible?).
|
Apr 26 | 4:30 PM |
Mark M. |
taking those in order...
|
Mark M. |
installing/updating: I'm not sure what your concern is, precisely
|
Mark M. |
registered multiple times: a manifest-registered BroadcastReceiver will only be in there once
|
AngelOD |
Hold on.. Let me look through my code. You can
talk to someone else in the meantime. Let me see if I can't find a
better way to ask. :)
|
Mark M. |
OK
|
Mark M. |
Julius: do you have another question?
|
Julius |
yes
|
Julius |
I know you don't use Eclipse but... I have some
Widgets that Eclipse doesn't handle well and recommends using:
View.isInEditMode(). I'm not sure how to go about using this or where
should I put it so I can continue to use the Graphical Layout editor in
Eclipse. Have you managed to get around this before?
|
Mark M. |
I haven't touched the graphical layout editor
|
Julius |
heh ok thanks
|
Mark M. |
that's a latter-half-of-2011 project
|
Julius |
:)
|
Mark M. |
sorry
|
Julius |
np
|
Mark M. |
Ahmet: do you have another question?
|
Ahmet |
yes.
|
Apr 26 | 4:35 PM |
Mark M. |
Ahmet: go ahead
|
Ahmet |
where to handle incoming call interrupts? onpause/onresume?
|
Ahmet |
does a call kill our activity?
|
Mark M. |
An incoming phone call will pause and stop your activity
|
Mark M. |
the activity may later get destroyed, if the call goes on for a long time and Android needs the memory
|
Mark M. |
as to "where to handle incoming call interrupts", you are thinking about it the wrong way, IMHO
|
Mark M. |
lots of things cause activities to be paused and stopped
|
Mark M. |
- User presses HOMe
|
Mark M. |
(er, HOME)
|
Mark M. |
- User chooses a Notification from the notification drawer
|
Mark M. |
- User places a phone call
|
Ahmet |
yes
|
Mark M. |
Think of it less as "incoming phone call" and "another activity taking over the foreground"
|
Mark M. |
onPause/onResume are the typical pair for events related to this, where you need them
|
Ahmet |
ok
|
Mark M. |
fitz: do you have another question?
|
Mark M. |
gonna take that as a "no"
|
Mark M. |
AngelOD: do you have another question?
|
Apr 26 | 4:40 PM |
fitz |
no I am good thanks
|
Ahmet |
I have one
|
Mark M. |
Ahmet: hold on
|
Ahmet |
ok
|
Mark M. |
navjeet: do you have another question?
|
Mark M. |
Julius: do you have another question?
|
Julius |
yes
|
navjeet |
one more on bluetooth
|
Julius |
have you seen any documentation on adding Application Widgets to the locked screen?
|
Julius |
(I can wait)
|
Mark M. |
navjeet: again, I have not worked with Bluetooth
|
Mark M. |
you will need to ask Bluetooth-related questions on StackOverflow, the android-developers Google Group, etc.
|
Mark M. |
Julius: there is no support for app widgets/RemoteViews on the lock screen, though there is a proposal on the table for it
|
Mark M. |
wouldn't shock me to see it early next year
|
Julius |
when you say no support...
|
Julius |
I guess I have seen it in a few apps
|
navjeet |
did some googling on bluetoth and found some ideas
on using intent android.bluetooth.intent.action.BONDING_CREATED and
BroadcastReciever might help in what I am trying to do. Do you have any
thoughts on that?
|
Julius |
(not trying to be difficult)
|
Mark M. |
navjeet: you will need to ask Bluetooth-related questions on StackOverflow, the android-developers Google Group, etc.
|
Apr 26 | 4:45 PM |
Mark M. |
Julius: you are probably seeing something like a window over top of the lock screen or some other crap like that
|
Julius |
:D
|
Julius |
heh ok
|
Mark M. |
the lock screen itself cannot be replaced or modified
|
navjeet |
ok
|
Julius |
ok thank you again
|
Mark M. |
that's part of the reason why there is discussion
of allowing the user to add an app widget or the equivalent -- it's one
way of exposing functionality cleanly to the lock screen without
compromising security
|
Mark M. |
Ahmet: do you have another question?
|
Ahmet |
yes.
|
Ahmet |
I am unzipping a big file in an AsyncTask, it is showing a progress dialog, all is ok but
|
navjeet | has left the room |
Ahmet |
when another activity takes over the foreground,
the zipping in the AsyncTask does not continue and the app crashes when
you try to return to the activity again
|
Mark M. |
well, the background thread of AsyncTask will continue to run
|
Ahmet |
I want it to continue in the background
|
Mark M. |
so I feel reasonably confident that your unzipping is continuing
|
Mark M. |
in terms of the app crashing -- what is the exception?
|
Ahmet |
let me check it
|
Mark M. |
meanwhile, if anyone has any remaining questions, go ahead and chime in
|
Ahmet |
.lang.IllegalArgumentException: View not attached to window manager
|
Ahmet |
on dialog
|
Mark M. |
this is probably from your progress dialog
|
Apr 26 | 4:50 PM |
Ahmet |
yes
|
Apr 26 | 4:50 PM |
Mark M. |
I don't use ProgressDialog much
|
Mark M. |
I think you may be trying to communicate with a dead dialog or something
|
Mark M. |
make sure this is a managed dialog, or otherwise arrange to have a fresh one in onResume() or something
|
Ahmet |
if I handle the dialog in onpause/onresume, will the zipping continue in the background?
|
Mark M. |
also, search StackOverflow, as I am sure this question has come up there before
|
Ahmet |
or do I have to handle the zipping, too?
|
Mark M. |
the zipping is independent of the dialog
|
Mark M. |
again, the background thread of your AsyncTask should be oblivious to what is going on in the activity
|
Mark M. |
the zipping should be continuing regardless
|
Ahmet |
ok, thanks. I will try it.
|
AngelOD |
Right. For when you have time. :) I have the
OnBootReceiver registered, which will ensure that the service starts up
when the device is rebooted. But how can I make sure that the service
starts up when they install/update the application?
|
Mark M. |
it won't start up when they install the application
|
Mark M. |
that is by design
|
fitz | has left the room |
Mark M. |
ideally, you don't start a service at boot time
|
Mark M. |
few services need to run all the time
|
Mark M. |
ideally, at boot time, you are setting up alarms for AlarmManager
|
AngelOD |
So what's the best practice in this case? Can I check if it's already running, and then start it up upon app start if it isn't?
|
Mike R. | has entered the room |
Mark M. |
regardless, for doing boot-time things after
install, keep a flag in a SharedPreference or something to detect
whether you have been run before
|
Julius | has left the room |
Mark M. |
in terms of an update, you can watch for the ACTION_PACKAGE_REPLACED broadcast, IIRC
|
Mike R. |
howdy
|
AngelOD |
That's what it does, using the WakefulIntentService component.
|
Mark M. |
right
|
Mark M. |
so, you would set up your alarm schedule in a boot-time receiver and the first time an activity is run in your app
|
Apr 26 | 4:55 PM |
Mark M. |
an easy spot to put that logic is in a custom
Application class, so it won't matter what activity they first visit, if
there might be more than one for some reason
|
Mark M. |
and, you would also set up the alarm schedule if
you have been upgraded when you get the ACTION_PACKAGE_REPLACED for your
package
|
Mark M. |
one of these days, I'll elaborate on these items in the books
|
Mark M. |
Mike R: only a few minutes left -- do you have a quick question?
|
Mike R. |
Probably take some time. When's the next one?
|
Mark M. |
Thursday
|
Mark M. |
7:30pm Eastern
|
AngelOD |
Aah okay. Thanks. :) I'll look into it. If I can't
figure it out, I'll come back next time, with a better formulated
question and code and such. Had an incident with a sick cat in the
middle of it all. Hence the delay. :)
|
Mark M. |
next East Coast business hours ones are next week
|
Mike R. |
see you thursday
|
Mark M. |
AngelOD: I hope your cat gets to feeling better
|
AngelOD |
Mark: Thanks. :)
|
Mike R. | has left the room |
Mark M. |
any last questions?
|
AngelOD |
Not from me. :)
|
Mark M. |
OK, that wraps up today's chat
|
Apr 26 | 5:00 PM |
Mark M. |
as noted, the next chat is Thursday, 7:30pm Eastern Time
|
Mark M. |
have a pleasant day, all!
|
Ahmet | has left the room |
AngelOD | has left the room |
Mark M. | turned off guest access |