Office Hours — Today, June 1

Thursday, May 27

Jun 1
7:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
NetApex
has entered the room
NetApex
Good evening
Mark M.
Howdy, NetApex!
NetApex
You were able to pick up an Evo weren't you?
Mark M.
At Google I|O, yes
8:00 PM
NetApex
Ok what are you thoughts on it?
Mark M.
Darn thing's so big, I can't find a case for it
:-)
NetApex
lol, Best Buy on Friday
Mark M.
Screen is gorgeous
Speed is in the Nexus One class
NetApex
Glad to hear it, that is going to be my next purchase
Mark M.
WiFi hotspot may come in handy
haven't played with the HDMI out yet -- doesn't come with the cable, and I'm not completely certain what the right cable is
Owen C.
has entered the room
Mark M.
howdy, Owen!
NetApex
Understood.. I wouldn't have a need for that just yet anyway
Owen C.
Hello
NetApex
Ok do you recall helping me with a sound board idea some time ago?
Mark M.
more or less
NetApex
You showed me the whole setTag() bit and it made life a lot easier for me
Mark M.
I'm all about making life easier
except perhaps mine
:-)
NetApex
Well I am redoing a lot of my old code now that I have learned a little more java and I need to know if there is a way to make that part easy again
hehehe
View paste (1 more line)
TableLayout layout = (TableLayout)findViewById(R.id.tlmain);
		ArrayList<Button> buttons = new ArrayList<Button>();

		for(int i = 0; i < layout.getChildCount(); i++) {
			//keeps you from getting anything but buttons
			if(layout.getChildAt(i) instanceof Button) {
				Button button = (Button) layout.getChildAt(i);
				// buttons.setTag("R.raw." + button);
				
				button.setOnClickListener(this);
				registerForContextMenu(button);

				//Add the button to the list
				buttons.add(button);
			}
...
For example, instead of having each and every button call done I have gone...
as you can see I have commented out the setTag area because... well.. it doesn't work lol
8:05 PM
Mark M.
you're trying to call setTag() on an ArrayList
NetApex
this way it reads my xml file and gets the buttons and places them as I want
I want to have the tag named the same as the button name
Mark M.
OK
NetApex
so obviously I am reaching for the wrong straw here huh?
Mark M.
well, the string "name" doesn't exist, strictly speaking
a View knows it's ID via getId() -- that's R.id.button37 or whatever your naming convention is
and I don't know of a way, given the actual integer, to come up with "R.id.button37" as a String
but you can put the tag in the XML
android:tag
NetApex
ok, say the button is named sound01, that way I can name the sound that plays when pressed sound01... could I cast the getID() to a string?
lol don't tell me I could just put a android:tag="sound01" in the xml?!
Mark M.
yes
NetApex
argh.. why is it always the easy answer I overlook?!
Mark M.
well, setting the tag in XML is not terribly common
in fact, I had to double-check that it was even possible
NetApex
Heheh well that's me.. always have to make the easy stuff difficult
But you saved me a lot of extra work once again!
Thanks a ton!
Owen my friend, the floor is yours
Mark M.
no problem
Owen C.
Hey So i'm just getting started actually
8:10 PM
Owen C.
I'm having a hard time following the book and I don't really know where to start
Mark M.
:-(
Owen C.
I have elipse with the avd pluggin working properly but i don't know where to go
Is life easier with ant?
Mark M.
well, I'm not an Eclipse user
Owen C.
ok
Mark M.
how much Java programming experience do you have?
Owen C.
a bit
not a whole lt
*lot
but basic objec oriented stuff
Mark M.
did you learn Java with Eclipse, or separately?
Owen C.
seperately
Mark M.
so you haven't done much with Eclipse yet, I'm guessing
Owen C.
but i've been using mostly eclipse lately
i've done some not a whole lot
Mark M.
ok
here is what I would recommend
First, do the "Hello, World" from the Android Developers site, since that is set up for Eclipse: http://developer.android.com/resources/tut…
Owen C.
yup i've done that
Mark M.
Then, I would recommend you work through the _Android Programming Tutorials_, starting with Tutorial #2 (#1 would be redundant if you have done "Hello, World")
at least go through #14
Owen C.
is that a better place to start than reading the book?
Mark M.
that will lead you step-by-step through building a basic Android app
8:15 PM
Mark M.
you have three books
not just one
_Android Programming Tutorials_ is one of the three
Owen C.
right
i mean are the tutorials better to start with?
Mark M.
if you have limited Java experience, I think the tutorials are a better starting place
once you get through tutorial #14, then you can start going back through _The Busy Coder's Guide to Android Development_ to get more depth on the Android topics you are interested in
Owen C.
ok thanks
ok cool
On the calendar I see office hours for today and tomorrow. Will there be more posted in the future?
Mark M.
yes
I don't usually schedule them more than a week in advance
my calendar gets...messy
Owen C.
Haha understandable
Mark M.
usually there are two a week
one in the morning US Eastern, one in the evening
though, depending on my schedule, sometimes there are fewer, or their times shift
Owen C.
Alright! Thanks for your help.
ok
Thanks again.
NetApex
I use Eclipse, and basically was (am) in the same boat Mark. It's been very useful to me to point out my errors. And of course the books are just great to work on.
8:20 PM
NetApex
Heck, my wife just bought me a book on Java last week so now I can understand more of why we do certain things.
Mark M.
once you start raking in the dough from your soundboard app, you'll be able to buy your *own* Java books! :-)
NetApex
lol, well the funny thing is I am probably going to charge for one of them since every week I get about 20 emails with "can you add this sound" to it.
Mark M.
charge for adding sounds
it's called "directed development"
occasional revenue model used in open source
NetApex
I'm like, hey, it was a hobby at first now it's getting to be really time consuming (granted it is still a ton of fun but ya know)
my main issue is file size.. you can only add so many sounds before it becomes a 25 meg app
Mark M.
on the plus side, over time, Apps-on-SD will become prevalent
8:25 PM
Mark M.
at that point, app size will become less of an issue
NetApex
true
I want to be able to stream the sounds without it going through the whole, opening mediaplayer dialog
(stream from a website that is)
Mark M.
dialog?
NetApex
well if you just point it to a file on the internet it does the jump to the browser, then pops open media player... I haven't done enough hunting to find a way to just have it play
Mark M.
are you just using startActivity()?
if you use MediaPlayer, you won't get the browser
(by MediaPlayer, I mean android.media.MediaPlayer)
NetApex
ahh ok I was going with a startActivity
Mark M.
check out the Media chapter in _The Busy Coder's Guide to Advanced Android Development_
8:30 PM
Mark M.
I show there doing streaming video with MediaPlayer, and doing local audio with MediaPlayer
NetApex
if I do MediaPlyer though I have learn how to make sure that they stop when they are supposed to so people can hit 8 or 9 buttons in rapid pace without crashing
Mark M.
that should help you understand how to apply MediaPlayer for streaming audio
that's not going to be easy with streaming
for local stuff, I'm assuming you're using SoundPool to handle that
NetApex
hmmmm
hehe.. umm.. yeah.. of course I am (note: look up soundpool)
Mark M.
SoundPool is designed for playing back several audio clips simultaneously
mostly used for games
NetApex
ahh that would be a much better choice than how I am doing then
Mark M.
in particular, it lets you set the maximum number of simultaneous clips to play
NetApex
that's where I need to focus some time then
Mark M.
you can then "fire and forget" the clips as the game needs them, indicating their priority, and SoundPool plays the N most important ones
however, SoundPool only works with local stuff
so you'd need to download any net-based clips
NetApex
ok
Mark M.
at least, I'm pretty sure SoundPool only works with local stuff
NetApex
I thought soundboard was more for games and therefore assumed it was over my head at the time
errr.. soundpool
Mark M.
I'm not sure how well it will fit your model, but it's worth peeking at
8:35 PM
NetApex
thank you again
8:40 PM
Mark M.
any other questions?
Owen C.
Not from me thanks
NetApex
Not at the moment
Mark M.
no problem, just checking
NetApex
Have you thought about making anything for the Evo? Something that shows off the front camera ability or anything?
Mark M.
well, I'm hoping a front camera API makes it into Android 2.3 or 3.0 or whatever Gingerbread gets called
at that point, I may play around with it
8:45 PM
Mark M.
I have plenty of things to work on more general to Android
rather spend time on that then on device-specific features, in general
NetApex
Good point
Owen C.
for the main.xml file in elipse, how do you just see it as a text file?
Mark M.
there should be a tab for that, underneath the preview pane, IIRC
Owen C.
thanks
NetApex
oh a request for future books...
REST and JSON stuff
8:50 PM
Mark M.
I take it you're looking for more than the Internet chapter presently has?
NetApex
hehe.. or maybe a book mark... I guess I missed that in there
Mark M.
doesn't cover JSON, but does make a REST-style GET request
NetApex
well my big issue is the how to display results
Mark M.
I recommend using an LCD screen
you could beep the results out with Morse code, but that might get tedious
:-)
more seriously, somebody needs to write a JSONAdapter
so if you're getting a list of stuff back, you can just run it through the adapter framework to put it in a list, spinner, etc.
NetApex
ok
Mark M.
that's now officially on my "things to write reusable components for someday"
NetApex
Cool, I will be the first to snatch that up too!
Mark M.
"where 'someday' may be measured in geologic timeframes, at my current list size"
speaking of such components, I haven't announced it yet, but I've updated the ColorMixer parcel to include a dialog (ColorMixerDialog) and a preference (ColorPreference)
NetApex
That's ok, I am patient
and I need to learn how to implement those too
8:55 PM
Mark M.
those meaning custom dialogs and preferences
?
NetApex
meaning the parcels that you have out there
Mark M.
ah
some scenarios can be covered by the new "library project" that debuted with the latest Android tools update
parcels would mostly be for wide-area reuse -- "library project" is mostly for reuse within a local team or individual developer (paid/free app versions)
I'm hoping to run a contest to get some more parcels written, later this year
gotta get our widget library beefed up -- too many people grousing about how Android's widgets pale in comparison to iPhone
Owen C.
Sorry to interupt- what is the easiest way to run an app on a device that i have written from eclipse?
NetApex
Well don't start the contest too soon.. I need to figure out more about them so I can learn how to write them
Oh, I know that one!!
Owen C.
sweet :)
Mark M.
Owen: first, turn on USB debugging and "allow apps from non-Market" in the Settings on the device
Settings > Applications (and > Development for the USB debugging one)
NetApex
Attach your phone via cable and if it is already setup, you can just goto run and it will ask if you want to use the emulator or the device (if your configuration is set to manual - otherwise it will go right to the device... found out the hard way)
Mark M.
right -- Eclipse should auto-detect the device and give it to you as a run option
Owen C.
hmm
9:00 PM
Owen C.
do i need to reboot eclipse?
NetApex
I spend many minutes trying watching my screen on the laptop as my phone that was charging via cable had the app up and waiting
Mark M.
not that I'm aware of, but, then again, I only see Eclipse in my training courses, when students use it
NetApex
which phone do you have?
Owen C.
nexus one
NetApex
when you hit run what happens?
Owen C.
i get the run as window
and it gives me a few options
android app android junit test java app
lots of them
Mark M.
you want "Android app"
NetApex
ok, you pick android app and then what happens?
Owen C.
that just runs the emulater
*emulator
NetApex
ok this time instead of hitting run, there should be a run configurations a little further down the menu
Mark M.
9:05 PM
Mark M.
and that's all the time I have for this evening
another chat is scheduled for tomorrow morning
should have two next week, probably Tuesday evening and Thursday morning
have a pleasant evening, all!
NetApex
you too!
take care
NetApex
has left the room
Owen C.
has left the room
Mark M.
turned off guest access

Thursday, May 27

 

Office Hours

People in this transcript

  • Mark Murphy
  • NetApex
  • Owen Coutts