May 31 | 9:50 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
May 31 | 10:05 AM |
Kevin M. | has entered the room |
Mark M. |
howdy, Kevin!
|
Kevin M. |
Good morning
|
Mark M. |
how can I help you today?
|
Kevin M. |
I'm having some problems with ListViews
|
Kevin M. |
1. Trying to get the height of an item to be bigger on tablets
|
Kevin M. |
2. Custom listview items that have clickable items
|
Mark M. |
1. Use a different rendition for your row layout that is bigger, putting it in res/layout-large/
|
Mark M. |
2. You would need to be more specific
|
Kevin M. |
For #2, I have a listview item that has a layout
with a checkbox, & 2 textview items. I want to click on the checkbox
and/or textview items
|
Kevin M. |
Seems as if the setOnItemClickListener doesn't work after that
|
Kevin M. |
For #1 I try not to use xml but code in the layout
|
Mark M. |
For #1, then I can't help you
|
May 31 | 10:10 AM |
Mark M. |
As far as I am concerned, for multiple screen sizes, anyone not using layout XML is asking for pain and suffering
|
Mark M. |
for #2, that is correct
|
Mark M. |
I think that rows should either be clickable or have clickable elements, not both
|
Mark M. |
I think there's some solution that involves making the clickable elements not focusable
|
Mark M. |
but I haven't tried it
|
Kevin M. |
I have had so much trouble getting simple layouts working. LinearLayout & RelativeLayout are a pain
|
Kevin M. |
Seems like they should just work
|
Mark M. |
LinearLayout is trivial
|
Mark M. |
RelativeLayout takes a bit of getting used to
|
Mark M. |
the new drag-and-drop stuff in Eclipse should help
|
Mark M. |
particularly after this summer's next update
|
Mark M. |
(i.e., the stuff they previewed at I|O)
|
Kevin M. |
I watched the google I/O talk and tried the current version in Eclipse and RelativeLayout didn't work well
|
Kevin M. |
I've written my own custom layout that works pretty well but has a few kinks (and it is a pain to get working)
|
Mark M. |
yeah, I tried once to create a custom ViewGroup subclass and failed miserably
|
Mark M. |
it's on my list of things to try again someday
|
May 31 | 10:15 AM |
Kevin M. |
I created a GridLayout that for the most part works but every once in awhile when I create a new layout, there are some issues
|
May 31 | 10:15 AM |
Mark M. | |
Kevin M. |
I could let you have it to look at, see what you think
|
Mark M. |
that SO question should help with #2
|
Kevin M. |
For #2, I've tried almost everything. Making the items not focusable, not clickable, writing custom touch events etc
|
Mark M. |
not sure I can help you with either question, then
|
Kevin M. |
Nothing works well. I looked at the built in checkbox support and that works by a custom control with 2 items in it
|
Mark M. |
what is supposed to happen if the user clicks on the row?
|
Kevin M. |
So, for checkbox items they use listPreferredItemHeight for the layout height. I wonder what that is
|
Mark M. |
listPreferredItemHeight is probably defined in an SDK style
|
Mark M. |
you can find a res/values/styles.xml in your SDK installation
|
Kevin M. |
So I want to display the title of a list item when they click on it
|
Mark M. |
yeah, OK, can't help there
|
Kevin M. |
So how goes the books?
|
Mark M. |
if your objective was that clicking a row should
toggle the checkbox, the row layout would simply have to implement the
Checkable interface, IIRC
|
Mark M. |
books are going
|
May 31 | 10:20 AM |
Mark M. |
wrapping up restoring some of the older tutorials back to that book
|
Mark M. |
gonna need to Eclipse-ify two of the books later this year
|
Kevin M. |
I have to say that it seems like I'm always learning more stuff about Android all the time
|
Mark M. |
NFC stuff should be coming to the Advanced Android title soon
|
Kevin M. |
I'd like to build a Honeycomb app soon
|
Mark M. |
ideally, you've done some work with fragments and the action bar by, say, October
|
Mark M. |
I suspect that this holiday's phones will mostly run Ice Cream Sandwich
|
Mark M. |
and some of the Honeycomb structures will be coming with it
|
Tarique | has entered the room |
Kevin M. |
I started on it but got stuck on the layout stuff
|
Mark M. |
I can understand
|
Mark M. |
howdy, Tarique
|
Tarique |
Hi Mark!
|
Mark M. |
Tarique: do you have a question?
|
Tarique |
Heloo everyone
|
Tarique |
No, not really, Just want to check the chat room and say hello9
|
Mark M. |
ah, OK
|
Mark M. |
the chat room tends to be more focused on people with questions, not so much just for hanging out
|
Mark M. |
but, you are welcome to lurk if you'd like
|
Tarique |
I may have in the future as I am going to start developing.
|
Mark M. |
Kevin: back to #1, usually the list rows' heights are dictated by their contents
|
May 31 | 10:25 AM |
Mark M. |
so, you'd need to detect the large screen device
(e.g., use Configuration object, or possibly DisplayMetrics) and create
the larger structures in Java
|
Tarique |
Good bye Mark
|
Mark M. |
Tarique: see ya!
|
Tarique | has left the room |
Kevin M. |
I have a ViewGroup that is set to wrap_content
|
Kevin M. |
should it be fill_content on the height?
|
Mark M. |
no, wrap_content is correct
|
Mark M. |
but you just need bigger content if you want the rows to be bigger
|
Kevin M. |
So, my first screen is a simple listview but on my tablet it is really small
|
Mark M. |
what is "it" that is "really small"?
|
Kevin M. |
Should I check the DisplayMetrics and divide the height to get the row height?
|
Mark M. |
probably not
|
Kevin M. |
The text in the row
|
Mark M. |
then use a bigger font
|
Kevin M. |
I would still probably need to check how much space I have
|
Mark M. |
detect large-screen devices and change whatever font size you are using with your TextView and CheckBox
|
Mark M. |
you should not care "how much space" you have, just the general class of screen size
|
Kevin M. |
Is there a call that says that this is a large screen?
|
Mark M. |
yeah, I was just looking for that
|
Mark M. |
the screenLayout member on Configuration is what you'd want
|
Mark M. |
you get a Configuration object from getResources().getConfiguration() in your activity
|
Kevin M. |
Yes, there is a screenlayout
|
May 31 | 10:30 AM |
Kevin M. |
Ok. So if I have a large screen, just set the font to a larger size
|
Mark M. |
large or xlarge
|
Kevin M. |
Great
|
Mark M. |
with the screenLayout, you'd need to check for both
|
Mark M. |
another possibility is for you to use a dimension resource
|
Mark M. |
res/values/dimens.xml for the normal case
|
Mark M. |
res/values-large/dimens.xml for large
|
Mark M. |
then use the dimension value when you set your font size
|
Mark M. |
only tricky thing here is that I've never used a
dimension resource from Java, so I don't know how easy or difficult that
will be
|
Kevin M. |
On another topic: I have an app out there that doesn't seem to be found by people. How do I get people to find it?
|
Mark M. |
marketing
|
Mark M. |
what's the target user base of the app?
|
Kevin M. |
User's of podcasts/music
|
Mark M. |
OK, check with various Android blogs for their
review submission guidelines, and find out places where podcast
listeners hang out and advertise
|
Kevin M. |
Did you enjoy Google IO?
|
Mark M. |
I found it informative but crowded
|
Mark M. |
actually, to some extent, I was pleased as to how crowded it was
|
Kevin M. |
Wish I could have gone. Couldn't get in
|
May 31 | 10:35 AM |
Mark M. |
I was afraid too many of the people who registered were there for HW giveaways
|
Kevin M. |
I work down the street from the center
|
Mark M. |
well, you had plenty of time to scout out where to use the grappling hook to climb into an unsecured entrance... :-)
|
Kevin M. |
When I went to sign up, it was already booked
|
Mark M. |
FWIW, two Android conferences coming to your area in October/November
|
Mark M. |
Android Open will be at some Hyatt downtown, IIRC
|
Mark M. |
AnDevCon 2011 II will be in Burlingame
|
Kevin M. |
OK. Will try and go
|
Kevin M. |
Another question. Can I continue an activity when I hit the back button?
|
Mark M. |
define "continue an activity"
|
Kevin M. |
So I have a music program that when I start playing, I don't want to shut down when I return to the previous screens
|
Mark M. |
your music playback should be in a service
|
Kevin M. |
It is
|
Mark M. |
then the activity should not be affecting the service
|
May 31 | 10:40 AM |
Mark M. |
did you start the service with startService()?
|
May 31 | 10:40 AM |
Kevin M. |
I guess I just need to not force it to stop when the activity quits
|
Kevin M. |
I think that is the problem. I'm binding to the service from the activity
|
Mark M. |
binding alone won't work well for the music player pattern
|
Mark M. |
either use the command pattern with startService(), or use binding but *also* use startService()
|
Mark M. |
then, only call stopService() when the user presses the Stop button (or equivalent in your UI)
|
Mark M. |
I illustrate this in the service chapters of _The Busy Coder's Guide to Android Development_
|
Mark M. |
a (fake) music player is one of the samples
|
Kevin M. |
So I can bind when I resume but also startService to start the music
|
Kevin M. |
I need to bind so that I can pass parameters
|
Mark M. |
you can pass parameters via extras in the Intent you use with startService(), too
|
Mark M. |
that's part of what I illustrate in those chapters
|
Mark M. |
personally, I haven't used both bindService() and startService(), so I don't know if there are any gotchas
|
Kevin M. |
I do things like skip, rewind, next song etc
|
Mark M. |
in theory, startService()/stopService() would be tied to UI requests to begin and end playback
|
Mark M. |
you can still use startService() for such commands
|
Mark M. |
but, if you want to stick with bindService(), you can do so, perhaps using most of your existing logic
|
Mark M. |
binding just gets to be a pain with configuration changes
|
Kevin M. |
So I use startService to start the music. stopService to stop and binding for the rest
|
Mark M. |
that's one approach
|
Mark M. |
in theory, it should work fine
|
Mark M. |
be sure to use startForeground(), with a Notification that leads the user back to whichever activity has the stop button
|
Kevin M. |
got that
|
May 31 | 10:45 AM |
Kevin M. |
I'll give that a try
|
Kevin M. |
I found listPreferredItemHeight in themes.xml
|
Mark M. |
ah, OK
|
Kevin M. |
64dip
|
fitz | has entered the room |
Mark M. |
I can never remember which are defined in styles.xml vs. themes.xml
|
fitz |
morning
|
Mark M. |
howdy, fitz!
|
Mark M. |
fitz: do you have a question?
|
May 31 | 10:50 AM |
fitz |
ya quick one - how can we program so our stuff in
not infected with this new virus stuff - is there a process we can take
to assure we are not targeted?
|
Mark M. |
I assume you're referring to stuff like DroidDreamLight?
|
fitz |
ya
|
Mark M. |
not really
|
Mark M. |
the perps are pirating apps, injecting their own class, modifying the manifest, and re-releasing them
|
fitz |
or is that all programmed to infect and we do not need to worry as long as our code is complied correctly
|
Mark M. |
you can monitor the Android Market for your own
app names to see if others show up that look like they might be pirated
copies of your app
|
Mark M. |
the act of injecting the malware is probably
automated, not sure if they're automating the uploading of the infected
stuff to the Market
|
Mark M. |
if you are using LVL or something similar, that *might* help
|
Mark M. |
insofar as they'd have to monkey with the LVL stuff, since it'd be out of sync with their revised package name for your app
|
fitz |
ok great thanks - just wanted to confirm and see if we needed to do any more steps - and all sounds good
|
Mark M. |
similarly, you might add smarts to your code that
compares the local signature with one stored on your server, but they
could disable that, just as pirates who are interested can disable any
defenses against LVL
|
May 31 | 10:55 AM |
Mark M. |
beyond that, I can't think of any defenses off the top o' my head
|
fitz |
ok thanks have a great day
|
Mark M. |
you too!
|
fitz | has left the room |
Mark M. |
we're running out of time -- any last questions?
|
Kevin M. |
That's it from me
|
Mark M. |
ok
|
Kevin M. |
bye
|
Mark M. |
have a pleasant day!
|
Kevin M. |
You too
|
May 31 | 11:00 AM |
Kevin M. | has left the room |
Mark M. | turned off guest access |