| Feb 3 | 9:50 AM |
| Mark M. | has entered the room |
| Mark M. | turned off guest access |
| Mark M. | turned on guest access |
| Feb 3 | 10:00 AM |
| Prasanna P. | has entered the room |
| Mark M. |
howdy, Prasanna!
|
| Prasanna P. |
Hi Mark, Quick qestion
|
| Prasanna P. |
Would you use preferences to keep track of something in a situation
|
| Prasanna P. |
where you want this piece of information ...
|
| Prasanna P. |
each time a service is invoked inside of the service?
|
| Mark M. |
I am completely lost
|
| Mark M. |
first, what is "each time a service is invoked inside of the service?"
|
| Prasanna P. |
sorry
|
| Feb 3 | 10:05 AM |
| Prasanna P. |
ok. basically using a preference from inside of a service ...
|
| Prasanna P. |
this preference say 'last_update_date' would be updated from the service ...
|
| Prasanna P. |
then next time the service is running, the service would want to look at this same ...
|
| Prasanna P. |
preference 'last_update_date' to find out its value. Then update this.
|
| Prasanna P. |
So that the next time the service is running ...
|
| Prasanna P. |
you can get this updated value again?
|
| Prasanna P. |
does this make sense?
|
| Mark M. |
yes, it now makes sense
|
| Mark M. |
can you use SharedPreferences? yes
|
| Mark M. |
would *I* use SharedPreferences? no
|
| Mark M. |
I reserve SharedPreferences for things collected from the user via a PreferenceActivity
|
| Mark M. |
everything else that fits goes in SQLite
|
| Mark M. |
simply for transactional integrity
|
| Mark M. |
in your case, I would go with a static data member
backed up by some persistent store -- that way, if the process sticks
around, you can skip the flash read operationg
|
| Mark M. |
er, operation
|
| Feb 3 | 10:10 AM |
| Prasanna P. |
by 'by some persistent store' you mean sqlite?
|
| Mark M. |
again, that's what I would use
|
| Mark M. |
if you wanted to use SharedPreferences or a flat file, you could
|
| Prasanna P. |
one more qs
|
| Prasanna P. |
to call a remote service that I create, I can use startService(Intent). Right?
|
| Mark M. |
um
|
| Prasanna P. |
No need of the binding stuff right?
|
| Mark M. |
you can send a command to a service via startService()
|
| Prasanna P. |
If I do not want a strong bind
|
| Mark M. |
whether it is "remote" or not depends on whether it is in a separate app
|
| Mark M. |
whether you use the command (startService()) or
binding (bindService()) pattern for any given service implementation is
up to you
|
| Feb 3 | 10:15 AM |
| Alexander K. | has entered the room |
| Prasanna P. |
so if you want to start a service by command (startService()) ...
|
| Prasanna P. |
and it is a remote service ...
|
| Mark M. |
(btw, howdy, Alexander!)
|
| Prasanna P. |
would you implement it like a local service ...
|
| Alexander K. |
hello Mark, hello Prasanna
|
| Prasanna P. |
ie the same code but in a different app
|
| Prasanna P. |
?
|
| Prasanna P. |
hi Alexander
|
| Mark M. |
the service implementation for the command pattern
is generally ignorant of whether the client is in the same app or a
different app
|
| Mark M. |
your onStartCommand() gets an Intent just the same
|
| Prasanna P. |
ok. got it. Thanks! Heading out. Enjoy the rest of the day.
|
| Mark M. |
the only big difference is that you will need to add an <intent-filter> with a custom action, to name the service
|
| Prasanna P. |
oh ok. still here ...
|
| Mark M. |
that is what clients will use in their Intents to identify which service to send the command to
|
| Mark M. |
also, it allows the service to be used from
another app; without an <intent-filter>, by default, the service
is not exported
|
| Prasanna P. |
got it.
|
| Feb 3 | 10:20 AM |
| Prasanna P. |
Thanks again Mark for your help.
|
| fitz | has entered the room |
| Mark M. |
no problme
|
| Mark M. |
er, problem
|
| Mark M. |
howdy, fitz!
|
| Mark M. |
Alexander: do you have a question?
|
| Alexander K. |
I do
|
| fitz |
morning - just learning so no specific questions
|
| Alexander K. |
hi fitz
|
| Alexander K. |
I created a custom component, trying to reproduce iPhone's UIPicker
|
| Alexander K. |
that seems like an ideal match for the task at hand: to have a meter with a variable number of dials.
|
| Alexander K. |
The component is based on a LinearLayout, to which the dials are added at run time
|
| Alexander K. |
I add the component to the layout like this:
|
| Alexander K. |
View paste
|
| Alexander K. |
It works fine on 2.2 and 2.3 SDK but on anything earlier the component remains invisible
|
| Mark M. |
what has Hierarchy Viewer indicated?
|
| Feb 3 | 10:25 AM |
| Alexander K. |
My guess is that Android notices that this is a LinearLayout and it doesn't have any children so it doesn't bother to display it
|
| Alexander K. |
Hierarchy Viewer?
|
| Mark M. | |
| Mark M. |
though note that the docs are somewhat out of date relative to new tools releases
|
| Mark M. |
I cover it in The Busy Coder's Guide to Android Development
|
| Alexander K. |
haven't looked at it yet
|
| Mark M. |
it allows you to inspect a running activity to see the various widgets and their properties at runtime
|
| Alexander K. |
great, will have a look
|
| Mark M. |
I'd use it to figure out where your widget is winding up
|
| Mark M. |
most likely, the android:layout_height="wrap_content" is your problem
|
| Mark M. |
if you have no content, you have no height
|
| Alexander K. |
I manage to get the component visible by adding a 1px by 1px view inside the layout
|
| Mark M. |
you are probably going to need a requirement of at least one wheel or something
|
| Alexander K. |
Here is the code of the component, not very verbose:
|
| Alexander K. |
well, just a part of it
|
| Alexander K. |
View paste
(16 more lines)
|
| fitz |
Does DDMS in Eclipse do the same thing as Hierarchy Viewer?
|
| Mark M. |
fitz: no, but newer editions of the tools has a Hierarchy View perspective in Eclipse
|
| Alexander K. |
the dispatchDraw is needed to make the component visible with the 1x1 view in it on 1.6
|
| Feb 3 | 10:30 AM |
| Mark M. |
Alexander: I don't see where you are qualifying the height
|
| Feb 3 | 10:30 AM |
| Mark M. |
bear in mind that I haven't written a custom component with custom onMeasure() and such, so I may be misunderstanding things
|
| Mark M. |
regardless, I'd start with Hierarchy View
|
| Alexander K. |
well, this is my first experience :)
|
| Alexander K. |
ok, will try to see what Hierarchy View shows
|
| Alexander K. |
the thing is: everything works fine on 2.2 and 2.3 platforms
|
| Alexander K. |
all right, thanks Mark
|
| Alexander K. |
and thank you for the books, they are a great help
|
| Mark M. |
glad you like them!
|
| Alexander K. | has left the room |
| Mark M. |
anyone have any questions?
|
| Feb 3 | 10:35 AM |
| fitz |
Quick one - you mentioned in books that PNG is a
nine-patch bitmap - so does this mean PNG's are best to use or use
something like ISO's
|
| Mark M. |
um
|
| Mark M. |
first, nine-patch bitmaps are PNGs; not all PNGs are nine-patch bitmaps
|
| fitz |
for graphic buttons
|
| Mark M. |
second, ISO is a CD/DVD disk image, not an image from the standpoint of graphics
|
| Mark M. |
I would recommend PNGs and JPEGs for your images
|
| fitz |
sorry ment ICO's
|
| Mark M. |
Android does not support the ICO image format
|
| fitz |
ok so png and make them nine-patch?
|
| Mark M. |
whether or not you make a PNG be nine-patch depends on how you want to use it
|
| Mark M. |
for the face of a button, no
|
| fitz |
ya you can tell I am from .net c# mentality :)
|
| Mark M. |
for the background of a button (i.e., what makes a button a button), yes
|
| Mark M. |
though in that case you need several .9.png files, one per relevant state (normal, focused, pressed, etc.)
|
| fitz |
ok - will just do PNG's - see simple questions :)
|
| Mark M. |
bear in mind that a PNG is what you will want in your project
|
| Mark M. |
however, given different screen densities, it helps if your actual original artwork is in some vector format (e.g., SVG)
|
| Mark M. |
so you can save the image at various resolutions for use at various screen densitiies
|
| Mark M. |
er, densities
|
| Feb 3 | 10:40 AM |
| Prasanna P. | has left the room |
| fitz |
hmm - ok so get into final format of SVG?
|
| Mark M. |
I would describe it as your initial format is SVG, exported to PNGs
|
| Mark M. |
though the actual vector format is up to the tools you are using for the graphics
|
| Mark M. |
e.g., Adobe Illustrator might use AI files instead of SVGs
|
| Mark M. |
SVG is the open standard for vector art, but not all tools support it equally well
|
| fitz |
ok great - do you have an example in books on how to scan emails to pull out data? keyword search etc.
|
| Mark M. |
well, you don't really have access to emails, unless you are using JavaMail or something
|
| Mark M. |
so, no, I have nothing in the books on that
|
| fitz |
would this be the case as well - no access to contacts or calendar
|
| Mark M. |
contacts are part of the SDK -- see android.provider.ContactsContract
|
| Mark M. |
chapter on it in The Busy Coder's Guide to Advanced Android Development
|
| Mark M. |
icky subject
|
| fitz |
those are the 3 components we are looking to get data from
|
| Mark M. |
there is no SDK support for calendar or email
|
| Mark M. |
mostly because there is no OS concept of calendar or email
|
| Mark M. |
those are just apps
|
| Mark M. |
they can be replaced
|
| Mark M. |
they can be changed
|
| Feb 3 | 10:45 AM |
| fitz |
Advanced book is not updated yet to 2.3 right - does it change a ton - if so I will focus on other to-do's till it is out
|
| Mark M. |
Advanced book will not be updated now until after Honeycomb ships and I get my grubby little hands on a XOOM or something
|
| Mark M. |
little *changed* (i.e., is now wrong) in the book due to 2.3
|
| Mark M. |
the camera chapter is updated with better samples, including front-facing camera support using 2.3
|
| Mark M. |
those samples are out in the GitHub repo, if you need them
|
| fitz |
ok - great thanks
|
| Mark M. |
otherwise, looking over my notes, there's nothing much 2.3-specific in the Advanced book
|
| fitz |
I am last one here so I will let you go thanks
|
| Mark M. |
lots of other improvements, and definitely some Honeycomb stuff
|
| fitz |
ok so you like honeycomb?
|
| Mark M. |
um
|
| Mark M. |
I have grave concerns over fragments
|
| fitz |
it looks like everyone will have to review code to make sure all looks ok
|
| Mark M. |
and, yes, it will require a fair bit of testing
|
| Mark M. |
and the whole Honeycomb-on-phones area is murky
|
| Mark M. |
otherwise, it seems fine
|
| fitz |
ya that way an interesting concept - wonder why they are focusing on this - gives us flexibility....
|
| Mark M. |
oh, we need that sort of flexibility
|
| Feb 3 | 10:50 AM |
| Mark M. |
however, their backwards-incompatible implementation is a mistake, IMHO
|
| Mark M. |
as a result, I have a pile of work ahead of me to write up ways of solving the problem that *will* be backwards-compatible
|
| Mark M. |
at least until 2013 and Honeycomb-on-up are 90+% of the market
|
| fitz |
ya so the chrome OS is for laptops - honeycome for
tablets and android for cells - interesting - I know tablets and cell
use android but you almost have to code to each with a different mind
set
|
| Mark M. |
don't forget Google TV
|
| fitz |
ya so you like me thinking honeycomb will kick some royal apple A**
|
| fitz |
oh ya TV ahhhhhh
|
| Mark M. |
unlikely
|
| Mark M. |
Apple's power is less in the OS than it is in the marketing juggernaut
|
| Mark M. |
Android has to get to 200-300% of the capability of iOS for the iOS-is-superior attitude to change
|
| Mark M. |
HC isn't there yet
|
| Mark M. |
and Android may never get there, since Apple keeps innovating
|
| fitz |
most android developers also do IPhone etc?
|
| Mark M. |
don't know about "most"
|
| Mark M. |
some certainly do
|
| fitz |
ya well we are betting on Android for now
|
| Feb 3 | 10:55 AM |
| fitz |
ok cya thanks for chat
|
| fitz | has left the room |
| Mark M. |
see ya!
|
| Feb 3 | 11:00 AM |
| Mark M. | turned off guest access |