Office Hours — Today, February 9

Tuesday, February 2

Feb 9
8:30 PM
Mark M.
has entered the room
8:35 PM
Mark M.
turned on guest access
Yoav E.
has entered the room
Yoav E.
Hi Mark
star
Mark M.
Howdy!
star
Yoav E.
I'm the guy from HP who fell asleep.
star
I have a question about TextView and ordered lists.
star
Mark M.
OK
star
Yoav E.
I didn't get answers on stackoverflow.
star
so far, i can use <ol> and <li>, but all I get is dots (*)
star
How can I get a numbered list?
star
Mark M.
If I had to guess, you can't get a numbered list
star
I'm shocked the bulleted list works
star
Yoav E.
hehe, :)
star
Mark M.
I remember seeing your post on SO and I didn't have an answer
star
Yoav E.
is my only choice then a webview?
star
Mark M.
Only if you need to convert it from HTML and have numbered lists.
star
You can create numbered lists "by hand" with newlines and 1). and such.
star
8:40 PM
Yoav E.
i don't have an html requirement, just a numbered list requirement.
star
yeah, but they don't line up :(
star
Mark M.
Not much to be done about that, unless you're willing to go monospace on the font
star
Yoav E.
unless there is html formating for indents, but I'm not familiar with html
star
Mark M.
You could do indents with CSS, but TextView is for simple HTML only
star
Yoav E.
ok.
star
Mark M.
You could do a numbered list with a TableLayout
star
Yoav E.
i'm just glad to know what the options are.
star
interesting,
star
one column for the numbers, left aligned, another for the text.
star
Scott S.
has entered the room
Scott S.
Howdy Mark
star
Mark M.
Yoav: right
star
Scott: hi
star
Scott S.
Scott Smith from HP here. I'm the one that asked what kind of tree you'd be...
star
Mark M.
Wow, an influx of HPers
star
Yoav E.
I told scott he has to wait until i'm done with my two questions.
star
Scott S.
We prefer the term 'infestation'
star
Yoav E.
i'll move to the 2nd question.
star
what's a good way to do cascade spinners.
star
Mark M.
What's a "cascade spinner"?
star
Yoav E.
say one for the make of the car, gm, form, toyota
star
the other for the model, which depends on the make.
star
Bob K.
has entered the room
Scott S.
Should I wait my turn to ask my question - is that how this works?
star
Mark M.
Scott: let's get through Yoav's first, if that's OK
star
Bob: hi!
star
Scott S.
Sure, no prob.
star
Mark M.
Yoav: Step #1: leave the 2nd spinner disabled to start
star
8:45 PM
Mark M.
Step #2: Hook up a selection listener on the 1st spinner
star
Bob K.
Hi! Mark, I just got around to buying your books; haven't got them downloaded, but based on your activities on the group, I'm looking forward to it.
star
Mark M.
Step #3: On a 1st spinner selection, then associate your adapter with the 2nd spinner and enable it
star
Bob: thanks!
star
Step #4: lather, rinse, repeat if you have more spinners in the cascade
star
Bob K.
I wonder what I'm going to find out what I didn't know I don't know... :) Don't let me distract you, I don't have a question, just havinng a look.
star
Mark M.
(and I do not recommend lathering with Cascade, as it'll make you smell like lemons)
star
Yoav E.
hehe
star
#1, how do you disable the spinner and why?
star
Mark M.
How: setEnabled(false) or android:enabled="false"
star
Yoav E.
i was kind of running into a problem where if you had selected an item on the 2nd spinner
star
Mark M.
Why: user can't use it until there's an adapter anyway, and you may as well have it grayed out
star
Yoav E.
and rotated the view
star
then the first spiner listener would fire, and reset the adapter to the 2nd spinner
star
and i would lose the selection on the 2nd spinner.
star
Mark M.
That's a timing issue
star
In your case, you would need to do stuff like this to handle that:
star
Step #1: Use onSaveInstanceState() to send to the rotated activity your current spinner selections
star
Step #2: In onCreate(), you will want to set your adapter and selection on the first spinner *before* registering a selection listener
star
Fix that
star
8:50 PM
Mark M.
Step #2: In onCreate(), you will want to set your adapter on the first spinner, then set the selection listener, then set the selection based on the Bundle passed to onCreate()
star
8:50 PM
Mark M.
If you register the listener before setting the adapter, setting the adapter will trigger the listener, which you don't want in this case
star
Something along those lines should clear up the rotation problem
star
Yoav E.
awesome. thank you
star
those were my two questions.
star
Mark M.
Scott: you're up!
star
Scott S.
OK
star
I have a layout where I'm displaying a drawable PNG in an ImageView
star
I want to rotate the image (let's say) 90 degrees.
star
It was trivial to find examples of how to set up the animation XML and trigger the animation
star
Mark M.
Hang on: be right back
star
Scott S.
...but as you pointed out, at the end of the animation, the image snaps back to it's original (0 degree) state
star
I assumed that I'd find some way to transform the ImageView (or the drawable within) to match the end-state of the animation
star
...but I couldn't find anything that worked.
star
It almost seems as though I have to override the drawing and rotate the canvas to do this - that doesn't seem right.
star
Yoav E.
has left the room
8:55 PM
Scott S.
From what I read, there were sort of three levels to animating stuff (or drawing complicated scenes with lots of movement)
star
The easy level involves using ImageViews, the other two required overriding OnDraw (I think)
star
So, that confused me.
star
Mark M.
Um
star
Scott S.
Also (#2) - I'm not clean on what I have to do in order to have several of the same image resources appear on the screen in different rotations
star
You (and the literature) mentioned that rotating one causes all instances to rotate
star
I've seen this, but I'm not sure of the best way to have independent instances of the same drawable
star
-done-
star
Mark M.
Well, I'm really sure I didn't talk about rotating one causing all instances to rotate in class, though I think I know what you're referring tod
star
er, to
star
hold on whilst I do a smidge of research
star
Scott S.
You may not have talked about rotating - it may have been some other transformation
star
...or maybe I just popped a brain cell along the way
star
...hope not, I have so few working ones left.
star
Mark M.
The only thing I mentioned that "all instances do the same" is if the user installs multiple app widgets and your AppWidgetProvider just updates all of them
star
Anyway
star
Scott S.
OK, maybe I read that somewhere and dreamed the rest.
star
NetApex
has entered the room
Mark M.
I'm fairly certain there's some code in Android to rotate a Bitmap
star
9:00 PM
Mark M.
You could try that, but you need to be careful about: http://developer.android.com/intl/fr/resou…
star
Scott S.
There is a RotationDrawable class (or something like that), but I didn't see a clear way to get the drawable out of the ImageView, rotate it, and put it back. Seemed like RotationDrawable was meant to be used with the "I'm gonna handle all the drawing by myself, bwa ha ha ha ha" method.
star
Mark M.
but other than simple RotateAnimations< I haven't messed around with trying to rotate images
star
hmmmm...no RotationDrawable class, so I'm not sure what you saw
star
Scott S.
I'm force-choking you (ala Darth Vader). Can you feel it?
star
Mark M.
No, but I'm in the middle of nowhere. If I can't get a cell signal, I assume I can't receive the Force.
star
Back to the issue, my best recommendation is trying StackOverflow or [android-developers]
star
Scott S.
OK, I haven't seen this page before - I will read.
star
Sigh, been there, unfortunately.
star
OK, well - it's useful to know that it isn't something completely obvious.
star
I'm probably going to go with the "I'll draw everything myself" solution anyway - just wanted to check on this for completeness.
star
Mark M.
Out of curiosity, where's the image coming from?
star
Scott S.
It's a PNG drawable resource.
star
Mark M.
Push come to shove, if there's a modest number of possible rotations, store the rotations as separate resources
star
9:05 PM
Mark M.
as the saying goes: crude, but effective
star
Scott S.
Yeah, I may go that direction. Thanks Mark. :-)
star
NEXT!
star
NetApex
I'm just here for the ambiance. Any chance I get to soak up some knowledge I am all over it
star
Mark M.
I feel like I should be offering a wine list
star
NetApex
hehehe
star
Scott S.
Ciao all.
star
Scott S.
has left the room
NetApex
Well if no one has questions...
star
Remember the soundboard I was working on a while back?
star
9:10 PM
Mark M.
Yes
star
9:10 PM
NetApex
It's up and in the wild now and only occasionally does it FC.. still no clue why, but that is another story
star
I have a question about arrays that would have made it a ton easier
star
I figured out a way to set up the buttons using an array but I was unable to get the Tag part to fit in there correctly
star
and of course without that, it was just a lot of buttons on the screen with no function
star
Mark M.
What do you mean by "the Tag part"?
star
NetApex
Where you showed me about using a Tag.. heck, let me pull up the code to make sure I say it right
star
Mark M.
Yeah, sorry, it's been a few weeks, IIRC
star
NetApex
ok, where I setTag(R.blah.blah) so I can getTag() later on to call that file.
star
Frankly it is a tough question to ask without being able to show you all of the current code vs the array I wanted to use code.
star
Mark M.
OK
star
9:15 PM
NetApex
It's something that I will have to post somewhere and if you have some time I can ask you to look at it and give your thoughts on how my life could have been much easier lol
star
Mark M.
K
star
NetApex
So.. enough with that, how about one that makes sense to answer instead
star
Mark M.
Taking an educated guess here: is your problem that you're trying to iterate and generate the R.blah.blah bits, rather than hardwiring in all those constant names?
star
NetApex
Yes, great guess
star
Mark M.
getResources().getIdentifier() is what you'll need
star
Bob K.
(Mark is busy reflecting...)
star
Mark M.
It's a little funky, and you definitely need to cache the results as it's not speedy, but it works
star
You give it the identifier pieces as strings, and it gives you the identifier back (i.e., the value that really is R.blah.blah)
star
NetApex
Hmm, ok I think that is something I may be able to work with.
star
Bob K.
How does that contrast with using Java reflection to iterate over the fields of R.blah? It may be better on the grounds of being semantically intended for the purpose, but other differences?
star
NetApex
I was also starting to fool around more with the sqlite bits and wondered if there was a way to make that all work easier
star
Mark M.
I think getIdentifier() uses reflection under the covers
star
9:20 PM
Mark M.
I'm not sure what the "the sqlite bits" are
star
NetApex
oh sorry about that, got side tracked there
star
I was looking at using SQL Lite and was wondering about being able to share a database between programs
star
Mark M.
Depends on how controlled you want that to be
star
NetApex
And would it be faster than accessing all of the button and text information from xml files
star
Mark M.
The only really safe way to do that is to have both programs run as the same user ID (android:sharedUserId in the manifest) and be signed by the same signing key. Then, each app can read the other's files.
star
NetApex
Ahh ok cool that sounds like a plan there
star
9:25 PM
Bob K.
I've got a question: PreferencesActivity.addPreferencesFromIntent(Intent) -- what's the driving use case?
star
Mark M.
Bob: beats the heck out of me
star
Bob K.
Is it just for the case where a particular set of preferences happens to be tied strongly to a single activity, and allows you to make that more clear? Or does it serve a larger purpose in a large system or over the life of a product?
star
Ah...
star
Mark M.
I've never understood that one
star
Bob K.
Trying to reverse engineer Intent there may be futile...
star
Mark M.
I don't even see where Android's using that internally
star
NetApex
heck, the more I type the more my ideas start to come to mind... In theory (still talking soundboard here) it should be possible to have one start, go out to the Internet and query a database, create the buttons and items based off of the online database info, and be able to play the media that is stored online right? Which would make the app smaller, let me update content like mad, and still provide all of the local benefits except maybe speed. Even the save as ringtone/notification bit should be possible
star
Mark M.
NetApex: yes
star
Bob K.
Maybe you can set preferences for other apps signed with the same key & android:sharedUserId?
star
(Go ahead, I'm done)
star
9:30 PM
Mark M.
NetApex: only problem is that it assumes an Internet connection, and so can't be used from, say, backwoods Georgia
star
NetApex
Hmm true
star
Bob K.
You could cache.
star
NetApex
I thought that too, but my phone (HTC Hero) is already complaining about lack of space
star
and the only thing it would be caching would be sound files really
star
Mark M.
Well, that's all the time I have for this evening
star
With luck, next week I'll be back up to two chat hours
star
NetApex
Ok man, have a good night and stay out of the snow
star
Mark M.
Well, I'm in backwoods Georgia right now, so snow isn't a problem just yet.
star
:-)
star
Have a pleasant evening, all!
star
NetApex
View paste
You too
star
NetApex
has left the room
Bob K.
has left the room
Mark M.
turned off guest access

Tuesday, February 2

 

Office Hours

People in this transcript

  • Bob Kerns
  • Mark Murphy
  • NetApex
  • Scott Smith
  • Yoav Epstein