Mark M. | has entered the room |
Mark M. | turned on guest access |
Jun 14 | 4:00 PM |
fitz | has entered the room |
fitz |
Hello
|
fitz |
just picking up new books -
|
Mark M. |
howdy, fitz!
|
Mark M. |
remember: lift with your knees, not with your back
|
Mark M. |
:-)
|
fitz |
so summer finally hit bat area :)
|
Mark M. |
"bat area"?
|
fitz |
bay
|
Mark M. |
ah
|
fitz |
ya typing to fast :)
|
Mark M. |
thought maybe it was a Giants reference
|
fitz |
so - I hard that there are 4.5 billion cell phones vs 1 billion PC's - is that a true stat? you hear the same?
|
Mark M. |
I've heard varying figures, but those sound roughly right
|
Mark M. |
bear in mind that "cell phones" != "smartphones"
|
fitz |
wow
|
Mark M. |
more people in China, developing nations, etc. will have a cell phone than a PC
|
fitz |
ya but that is amazing - so many people must just have cells and no PC's
|
Jun 14 | 4:05 PM |
fitz |
I have not looked into this at all but is it a recompile to get a localized version? or a ton more to it?
|
Mark M. |
define "localized version", and what, specifically, you're localizing
|
fitz |
language specific version
|
Mark M. |
of what?
|
Jun 14 | 4:10 PM |
fitz |
does the phone handle language differences or do we code for it - IE English version, Chinese version etc.
|
Mark M. |
OF WHAT? an app?
|
Mark M. |
the OS itself?
|
Mark M. |
something else?
|
Kathy | has entered the room |
Kathy |
Hello everyone.
|
fitz |
app
|
Mark M. |
howdy, Kathy!
|
Mark M. |
fitz: you need to supply the strings
|
Mark M. |
e.g., res/values/ for English, res/values-es/ for Spanish, res/values-de/ for German
|
Mark M. |
Android then will use the right strings in the right cases
|
fitz |
ok - just asking - when I get to that I will read up on it - thanks
|
Mark M. |
Kathy: do you have a question?
|
Kathy |
Yes, I want to create a custom button that when
pressed parts of it will change color. What would be the best way to go
about this.
|
Mark M. |
um, I don't even know if that's possible
|
Jun 14 | 4:15 PM |
Mark M. |
the whole Button is either pressed or not
|
Kathy |
Well, when you press a radio button parts of the button changes color, not all of it.
|
Mark M. |
oh, I see
|
Mark M. |
actually, the whole image changes
|
Mark M. |
it just so happens they chose images where some pixels are identical
|
Mark M. |
so, what base widget are you looking at for this: Button? ImageButton? CheckBox? RadioButton? ToggleButton? something else?
|
Chris | has entered the room |
Mark M. |
howdy, Chris!
|
Chris |
Yo
|
Chris |
I'll have a question in a little bit.
|
Mark M. |
OK
|
Kathy |
I think probably a radio button since only one can be chosen at a time. I am flexible on this.
|
Mark M. |
OK, you need to replace the StateListDrawable that is used for the RadioButton button image
|
Mark M. |
that is defined in btn_radio.xml in your SDK resources
|
Mark M. |
it points to a series of PNG images based on density
|
Mark M. |
you'd copy all those into your project and modify the PNGs to suit
|
Mark M. |
then use setButtonDrawable() to associate it with the widget
|
Jun 14 | 4:20 PM |
Mark M. |
to be more specific, "to associate your custom btn_radio.xml, as R.drawable.btn_radio, with the widget"
|
Kathy |
Thank you, that is very helpful. If I decided to do an imagebutton, what would be my approach?
|
Mark M. |
well, if you're looking for "click the widget, and the image changes" behavior, I would not recommend an ImageButton
|
Mark M. |
though, you could use it and just call setImageResource() to replace the image in the foreground of the button
|
Mark M. |
actually, ImageButton isn't too bad for that, I guess
|
Kathy |
I want them to click the button, not necessarily in a list and go to another screen when the button is clicked.
|
Mark M. |
then they'll never see the image change, no matter what the widget is
|
Mark M. |
why are you worrying about changing the image?
|
Mark M. |
let me take questions from the others, and I'll circle back to you
|
Mark M. |
Chris: are you ready for your question?
|
Jun 14 | 4:25 PM |
Kathy |
I have an image that when pressed will change
color. For example a flower shape and when the flower is pressed as
part of the button, the flower would turn pink.
|
Chris |
Not yet. I'm trying to eat some lunch and take
care of something but I'll be ready in a few minutes. I just wanted to
join because if I didn't I'd forget and it would be time to go home.
|
Mark M. |
Kathy: but if as soon as they touch the button, they "go to another screen", they will never tell that the flower turns pink
|
Mark M. |
ah, OK
|
Mark M. |
fitz: do you have another question?
|
fitz |
not for now thanks
|
Mark M. |
Kathy: OK, we can continue if you have further questions
|
Mark M. |
fitz & Chris: chime in if you want to ask a question
|
Kathy |
View paste
|
Chris |
I'm composing my question because it's long :)
|
Jun 14 | 4:30 PM |
Chris |
But the answer will probably be simple.
|
Mark M. |
Kathy: If you make the ListView have
android:choiceMode="singleChoice" and use a CheckedTextView for the rows
(or make the rows support the Checkable interface), you get radio
buttons on each row, on the right
|
Mark M. |
kinda like you see in various list dialogs
|
Mark M. |
or, if there will only be a couple of RadioButtons, put them in a RadioGroup and the RadioGroup in a ScrollView
|
Kathy |
Okay, thanks, I will try that. Thank you so much.
|
Jun 14 | 4:35 PM |
Chris |
OK, you may not remember, but last time I asked
about the max connections for the HttpClient and you said you usually
don't see that being manually set so I took that out and everything
works fine. So I'm just learning and kind of flailing around. Right
now my app logs in to a the server and displays a list view of
organizations that a user can access. They select and org and then it
displays inventory objects like virtual machines, networks, etc. I'm
not sure the best way to handle working with the listview. So when
someone selects an item from the list it will query the server with the
item's href. So the href needs to be assosiated with the item that was
selected. At first I just had two arrays. One for the item and one for
the href and then I would index them in the onClickListener, but that
seemed dumb. So this time I created a class like VM with two functions:
getName() and getHref(). Then I build a list of these objects and pass
it into the listview. Then I use that setTag() to the view so later on
in the onClickListener I can use getTag() and then like getHref().
Does that seem OK?
|
Chris |
I was also thinking of storing the inventory items in a database and using that with cursor adapter
|
Mark M. |
you don't need setTag()/getTag() for the ArrayAdapter/ArrayList scenario
|
Mark M. |
when the user clicks an item, the position parameter is the index into your ArrayList
|
Mark M. |
or, call getItem() on the ArrayAdapter
|
Mark M. |
whether or not you should store the stuff in a
database depends on whether or not you need to persist the info (e.g.,
offline access)
|
Mark M. |
if you need to fetch it every time regardless, no sense in spending cycles on file I/O
|
Jun 14 | 4:40 PM |
Chris |
Hmm I'll look into the getItem(). I'm going to bring up my project to see why I thought I needed setTag()
|
Chris |
oh my goodness.
|
Chris |
OK, I see :)
|
Chris |
I was like man that doesn't seem right.
|
Mark M. |
with ListView, getTag()/setTag() are mostly used for findViewById() lookup caching
|
Mark M. |
if anything at all
|
Chris |
Yeah I remember seeing that in one of your books and thinking that I bet I'm not using it correctly.
|
Chris |
OK, you've answer that question. Someone else can go.
|
Mark M. |
at this point, it's pretty much a free for all
|
Mark M. |
if anyone has a question, chime in
|
Chris |
This isn't really a question, but I messed up my
sdk and downloaded a new version and when I run the emulator it's real
big and ridiculously slow. It used to be about the size of my phone and
fast.
|
Jun 14 | 4:45 PM |
Mark M. |
you probably created an AVD for Android 3.0 or 3.1, which are designed for tablets
|
Chris |
I use the snapshot feature and I guess it's OK
once it gets up and running but I like the old one a lot better but no
idea what type of config it had :(
|
Mark M. |
for a phone-sized one, create an AVD for 2.2 or 2.3
|
Mark M. |
the emulator speed is driven mostly by emulated screen size, which is why the tablets are so much slower
|
Chris |
Well it's shaped like a phone but like 8" tall haha
|
Chris |
I'll check though.
|
Chris |
OK, I want to know how to make menus like in the Google music app.
|
Chris |
Like you select an item and it expands to show you more items.
|
Chris |
What should I look into for that?
|
fitz |
question - if I have a gmail account set in phone -
can my app access that user info to slice a dice info in my app -
providing the user give my app permission? or do I need to create a
settings function in my app
|
Mark M. |
Chris: you mean like in the Artists tab, where entries fold out underneath the artist name for each album?
|
Mark M. |
that's ExpandableListView
|
Mark M. |
fitz: I do not know
|
Chris |
Yep, okay thanks.
|
fitz |
ok
|
Mark M. |
I would have hoped that your question would have been covered in that "using Google GData APIs from Android" I|O presentation
|
Mark M. |
which I haven't watched yet
|
fitz |
cya have a great day
|
Mark M. |
see ya!
|
fitz | has left the room |
Jun 14 | 4:50 PM |
Kathy |
Goodbye all, thanks for the help and patience.
|
Mark M. |
have a pleasant day!
|
Chris |
Mark, I don't have anything else right now.
|
Chris |
Thanks a lot.
|
Mark M. |
happy to help!
|
Chris |
later
|
Chris | has left the room |
Jun 14 | 5:00 PM |
Mark M. |
have a nice day, everyone!
|
Kathy | has left the room |
Mark M. | turned off guest access |