Office Hours — Today, February 23

Tuesday, February 21

Mark M.
has entered the room
Mark M.
turned on guest access
Feb 23
4:05 PM
Juan A.
has entered the room
Mark M.
howdy, Juan!
how can I help you today?
Juan A.
I'm currently going over version 3.7 of your The Busy Coder's Guide to Android Development eBook
I read 3.3, I think
I noticed some changes on the content so far (since I started over for Android 4.0)
I found that you changed some parts, but not much in others
Do you have a diff version of the book?
Or you recommend me starting it over
Mark M.
I recommend that you read the sections that pertain to whatever it is that you are doing
as part of The Big Book Reboot, I am setting up changemarks, which will be viewable in some formats on some readers
so that will help in the future
but even that will only show differences between successive releases, not from, say, 3.3 to 3.7
Juan A.
ok
4:10 PM
Juan A.
Ok, thanks.
Juan A.
has left the room
4:40 PM
tunneling
has entered the room
tunneling
lonely?
Mark M.
howdy, tunneling!
had someone in earlier, who then left
how can I help you today?
tunneling
hola
i was going to tell you that I did manage to get Ant script to work in Eclipse
you add it as a Builder, and it will run the script based on Clean, Autobuild, etc
Mark M.
OK
4:45 PM
tunneling
Do you have anything the books on building custom widgets?
Mark M.
that depends on how custom you want :-)
tunneling
Like a Button that looks and behaves like the buttons in the Music app
Mark M.
there is a custom widget chapter in the Advanced Android book, showing how to wrap up a bunch of other widgets in a composite custom widget
I don't know what "a Button that looks and behaves like the buttons in the Music app" means
tunneling
plain .. almost like a text view
Mark M.
that's probably a question of setting up custom backgrounds and such
not creating a new widget
unless the behavior is markedly different
tunneling
but i'd like to make the on click behaviors.. like background colors and all common
Mark M.
sorry, but I am having difficulty parsing that sentence
4:50 PM
tunneling
sorry, i was distracted.
In the Google Music app, the interface is very plain, and simple. Another example is the Phone app. I would like to understand how to make a "Button" that looks and behaves that way.
Mark M.
which buttons specifically in Phone are you referring to?
tunneling
The numbers.
Mark M.
who says those are buttons?
I'd do those as ImageView widgets
tunneling
Me
Mark M.
using a StateListDrawable for the image
tunneling
That's why I'm asking, because idk
Mark M.
with different images for pressed, etc. states
I mean, it's possible those are ImageButtons
but the difference between ImageButton and ImageView is largely in the background
so if you don't want the stock backgrounds, you may as well just start with ImageView
the way buttons, etc. use different images for different situations (normal, pressed, focused, etc.) is via a StateListDrawable
tunneling
now we're talking.. ok.. writing this down
Mark M.
4:55 PM
tunneling
got it bookmarked.. thanks.
Mark M.
I don't have tons on this in the book, though I think I have a short StateListDrawable example in the Advanced Android book, in the section on custom ListViews
tunneling
ok.
Mark M.
basically, inside the <selector> element you have a series of <item> elements indicating rules (e.g., android:state_pressed="true") and the image to use in those cases
tunneling
ok, that makes sense
Mark M.
this XML then goes in res/drawable/, as it is density-independent on its own
tunneling
what about transition effects? like a glow or something?
Mark M.
that's in your images
if you want a foreground image and a glow in the background, then use the StateListDrawable for the background
that's what a Button or ImageButton does
tunneling
ok.
I've read the section on Plugins again, but haven't had time to play around with it. Is it possible to send just about any object the way you send the RemoveView?
Mark M.
it has to implement the Parcelable interface
and creating your own custom Parcelable objects can be troublesome
tunneling
The other night, you mentioned using the Command pattern with this method. I read up on that too.
Mark M.
where possible, use OS-supplied Parcelable classes (e.g., pour your data into a Bundle)
5:00 PM
tunneling
So I have this book on patterns,and it talks about a Command with a single method "execute()" .. I can stick an instance of Command into a Bundle?
Mark M.
um
my use of the term "command pattern" was generic, not specifying particular class names
tunneling
ok
Mark M.
personally, I would consider the Bundle that is the Intent extras to *be* the Command object
and put whatever data you need in the extras
tunneling
gotcha
Mark M.
for example, the FakePlayer sample covered in the book uses extras for the shuffle mode, playlist, etc.
that being said, you are welcome to try to make a Command object that is Parcelable
and use that in an Intent extra
the problem is that sometimes the OS wants to convert a Parcelable back into an object, for inexplicable reasons
and if it's your own custom Parcelable class, it can't do that
and your code goes "boom"
tunneling
oh
Mark M.
that's why I try to avoid creating custom Parcelable classes where possible
tunneling
so I really need to just focus on sending key/value pairs
Mark M.
yes, it breaks the OO a bit
yes, though Bundle itself is Parcelable, so if you have a more nested structure, you can use that
Darryl B.
has entered the room
tunneling
ok
Mark M.
and you can also store an array of Parcelables IIRC
howdy, Darryl!
the chat is just about over
do you have a really quick question?
Darryl B.
Hello, I keep forgetting it is on ET
tunneling
i'm out Mark, thanks!
Darryl B.
no thats ok I had a question but it is not pressing I can wait until the next chat
Mark M.
OK
Darryl B.
take care I'm out
Mark M.
next weeks chats are at a different time: 9am Eastern, Tuesday and Thursday
5:05 PM
Darryl B.
ok thanks
Mark M.
have a pleasant day, all!
Darryl B.
has left the room
tunneling
has left the room
Mark M.
turned off guest access

Tuesday, February 21

 

Office Hours

People in this transcript

  • Darryl Brown
  • Juan Alberto Aranda-Alvarez
  • Mark Murphy
  • tunneling