Mar 30 | 7:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mar 30 | 8:00 PM |
George S. | has entered the room |
George S. |
Hello Mark.
|
Mark M. |
howdy!
|
George S. |
I emailed you about the shared preferences issue.
|
George S. |
I'm still having no luck with it.
|
George S. |
I'm unable to read a value from a ListPreference
|
Mark M. |
OK
|
Mark M. |
Have you looked at the relevant examples from my books, to see where things differ?
|
Mark M. |
Just trying to figure out how best to go about resolving your problem...
|
George S. |
I've
looked thru your book and others and everything I find close to what
I'm doing says I'm doing this correctly. I debug agains the Droid phone
|
Mar 30 | 8:05 PM |
Mark M. |
OK
|
George S. |
It's
odd for sure. I have the lists, I can show the preferences, etc. No
errors are presented, unless somethings hidden in the log
|
Mark M. |
Can you toss your arrays.xml file into a pastebin somewhere and link to it here in the chat?
|
George S. |
yes...
|
George S. | |
George S. |
oh.. pastebin... I've never used one of those.
|
Mark M. |
Have you tried reading your preference via getString() instead of getInt(), since your ListPreference is made up of strings?
|
George S. |
yes...
|
Mark M. |
and what happens when you do?
|
George S. |
nothing
|
George S. |
samething.
|
George S. |
no errors in the designer.
|
Mar 30 | 8:10 PM |
George S. |
I'm
not great with debugging yet on this platform so there may be a way to
get information I'm missing, with regards to any errors
|
Mark M. |
oh, wait
|
Mark M. |
you're using the wrong SharedPreferences
|
George S. |
I've tried both
|
Mark M. |
View paste
|
George S. |
getdefault and that one
|
Mark M. |
getDefaultSharedPreferences() is the right answer for ordinary PreferenceActivity cases
|
Mark M. |
have you tried running my samples on your DROID?
|
George S. |
no.
|
Mark M. |
OK, try the Prefs/Dialogs one
|
George S. |
I've only used them as a guide. Along with a bunch of googling.
|
Mark M. |
that has a ListPreference
|
Mark M. |
either it works on your DROID, or it doesn't
|
George S. |
ya, harder to find examples that fit my need
|
George S. |
ok
|
Mark M. |
if it does, you have to find the differences -- there's no other way I can debug it for you
|
Mark M. |
if it fails, that'll stun me, but let me know
|
George S. |
bummer.. ok.
|
George S. |
another issue that thru me but I figured out
|
Mark M. |
for the code you have, stick with getDefaultSharedPreferences() and getString()
|
George S. |
ok
|
George S. |
on the array file
|
George S. |
both string then right (not a mix of string and array for the actual values)?
|
Mark M. |
your arrays.xml file seems OK, if that is what you mean
|
George S. |
ya.. sorry lol
|
George S. |
one more thing right off
|
George S. |
I ran into using "this" verses "getApplicationContext()" verses "[activity_name_here.this]"
|
Mar 30 | 8:15 PM |
Mar 30 | 8:15 PM |
Mark M. |
most likely, you do not want getApplicationContext()
|
George S. |
I spend hours and realized I could use "main.this"
|
George S. |
What are the differences?
|
Mark M. |
getApplicationContext() is useless, MyActivity.this is not :-)
|
George S. |
lol
|
Mark M. |
Your Activity is a perfectly suitable Context wherever you need one
|
George S. |
good.. good that will narrow that down for me.
|
Mark M. |
getApplicationContext() will return the Application object associated with your process
|
Mark M. |
not that useful, particularly for UI-related stuff
|
George S. |
ah, okay thanks. I have another if you are up for it?
|
Mark M. |
blows up, etc.
|
Mark M. |
go ahead
|
George S. |
ok.. thx
|
George S. |
I'm looking at renameTo() tonight....
|
George S. |
I want to take a file on the sd card, renamed it (or copy and paste it if you will)
|
Mark M. |
OK
|
George S. |
so
I have an audio file that is on the sd card. ive got a AlertDialog that
comes up.. I want to grab that value (string) and use it in the path.
|
Mark M. |
OK
|
George S. |
so
that the user can have the audio file named they way they want it and
the other file gets removed. then upon the next recording the 3gpp gets
made again. I just need the rename issue solved.
|
George S. |
thx
|
Svetlin S. | has entered the room |
Mar 30 | 8:20 PM |
Mark M. |
howdy, Svetlin!
|
Mark M. |
George: was there a question related to renameTo()?
|
Svetlin S. |
Hi to all!
|
George S. |
yes. I just wanted to flesh it out a bit, big picture stuff.
|
George S. |
Hello.
|
Mark M. |
what you are describing sounds OK
|
George S. |
ok. can you do a code snippet up on that?
|
Mark M. |
On calling renameTo()?
|
Mark M. |
that's just standard Java
|
George S. |
yes please
|
George S. |
Oh, I'm new to Java... lol
|
Mark M. | |
George S. |
ok thx.
|
George S. |
I'm all done, thanks again Mark.
|
Mark M. |
Svetlin: did you have a question?
|
Mark M. |
George: no problem
|
Svetlin S. |
Yes, I have two questions regarding the camera functionality.
|
Svetlin S. |
Firstly, I am trying to start it and just take a picture, however the picture is too small.
|
Svetlin S. |
Here is the code:
|
Svetlin S. |
View paste
|
Mar 30 | 8:25 PM |
Svetlin S. |
and then in onActivityResult
|
Svetlin S. |
View paste
|
Mark M. |
OK
|
Mark M. |
I have not used this technique
|
Mark M. |
I tend to create my own Camera activity, for greater control
|
Mark M. |
I have heard others with a similar image-size issue
|
Mark M. |
I do not know what the problem is, though, off the top of my head
|
Svetlin S. |
The interesting thing is that this way I am starting the camera intent with the option to change settings.
|
Svetlin S. |
So I see in the setting of the started intent that, say 5MP, Fine quality is chosen.
|
Svetlin S. |
And still the resulting image is just 5-7K in size.
|
Svetlin S. |
(I don't need more control over the camera, this would be fine)
|
Svetlin S. |
Will you take a look maybe later, Mark, or do you suggest I'd rather post this in the forums?
|
Mark M. |
You'll have better luck in the forums, I think
|
Svetlin S. |
OK.
|
Mark M. |
I will eventually look to experiment with that technique, but probably not any time soon
|
Svetlin S. |
Second question, then.
|
Mar 30 | 8:30 PM |
Svetlin S. |
What is the proper/best way to resize/compact an image for upload to a web service?
|
Mark M. |
Wait, first the images are too small, and now they're too big? :-)
|
Svetlin S. |
I am giving the option to the user to choose of all images, regardless of how they are taken.
|
Svetlin S. |
E.g. the user has used the camera standalone (which results in ~800K file), and only after that to use my app just for upload.
|
Mark M. |
Bitmap has a createScaledBitmap() method
|
Svetlin S. |
What about:
|
Svetlin S. |
View paste
|
Svetlin S. |
OK, but then how do I convert the Bitmap to, say, ByteArrayOutputStream?
|
Mark M. |
That might work
|
Svetlin S. |
I'd have to use BitmapFactory.Compress() and that has disastrous effect, no matter which quality I choose..
|
Svetlin S. |
Right? Or is there another way?
|
Svetlin S. | |
NetApex | has entered the room |
Mark M. |
I haven't used any of the Bitmap conversion methods
|
Mark M. |
Mostly because I haven't been creating images on-device, just consuming them from elsewhere
|
Mark M. |
howdy, NetApex!
|
Mar 30 | 8:35 PM |
Mark M. |
I'm sorry that I'm not expert in your particular topics this evening
|
NetApex |
Good evening
|
Svetlin S. |
OK, how do I convert the Bitmap to a byte[] ot ByteArrayOutputStream then...?
|
Mark M. |
A Bitmap isn't a PNG or JPEG
|
Mark M. |
so, you'd have to write the Bitmap out to a file (e.g., via compress()) and use it that way, AFAIK
|
Svetlin S. |
I see. OK, thanks Mark!
|
Svetlin S. |
I think I am done now.
|
Svetlin S. |
Again, much appreciated.
|
Mark M. |
sorry I couldn't be of greater help
|
Mark M. |
anyone else have a question?
|
George S. |
I do if no one does... lol
|
George S. |
NetApex?
|
NetApex |
Go for it
|
George S. |
ok.. thx
|
Svetlin S. |
Have a good night, everyone :-) !
|
George S. |
I'd like to take the 3gpp file Mark and convert it or it's contents as it were to .mp3
|
George S. |
same to you Svetlin.
|
Mar 30 | 8:40 PM |
Mark M. |
3gpp video file?
|
George S. |
oh, audio.
|
Svetlin S. | has left the room |
George S. |
I'm using MediaPlayer and MediaRecorder to capture such. It would really help if such could get into .mp3 format
|
George S. |
at the least .wav
|
Mark M. |
Write a Web service and upload it there to do a conversion
|
Mark M. |
I do not believe you're going to get much in the way of transcoding help of that nature built into Android
|
NetApex |
Lol and now you are heading towards my question.
|
Mark M. |
You could look at the NDK and using some existing transcoding C library, I suppose
|
George S. |
ah, both great ideas.
|
George S. |
Thanks for those. NetApex, I'm done.
|
NetApex |
Ok
|
NetApex |
There
is a site savevid.com that lets you put in a url of a website that has
a video and it gives you back a mp4 version (among others) that you can
download.
|
George S. |
ah, thanks.
|
Mar 30 | 8:45 PM |
NetApex |
I
am trying my best to figure out the best way to hand off the url to
them and get the output back in a way I can say "this is the file,
start streaming"
|
Mark M. |
well, you're going to have some issues
|
NetApex |
lol
|
NetApex |
that was not the answer I was hoping for.. but the one I was afraid of
|
Mark M. |
First, you'll want to check their terms of service to see if that's legal
|
NetApex |
Already have an email off to them for permission
|
Mark M. |
Then, there's a very good chance their MP4 output is not going to be "safe for streaming"
|
NetApex |
Ugh, didn't consider that part
|
Mark M. |
I
would manually upload a file, manually get the URL to the MP4, and
embed that in a VideoView (or use my vidtry sample app), and see if it
plays on a device
|
Mark M. |
If
it does, then, since they don't appear to have a Web service API,
you'll need to simulate form input and do some HTML scraping
|
Mark M. |
If it does not play back, either they add more smarts to their side, or you're screwed
|
NetApex |
I
pulled a file using their site and uploaded it onto my site and tested
the streaming in one of my (ok, two) soundboards just to get some
others feed back on it... so far it's ok
|
Mark M. |
bear
in mind that with a VPS, you could accomplish the same thing yourself
with Handbrake and MP4Box, and get safe for streaming results
|
Mark M. |
OK, well, that sounds like you're getting lucky on the file conversion
|
NetApex |
ok handbreak and mp4box... must Google those
|
Mark M. |
Handbrake is a DVD ripper and format converter, a bit easier to use than mplayer or ffmpeg directly
|
Mark M. |
MP4Box is the class "oh, fix the $#(#)#$( safe for streaming problem" tool
|
Mark M. |
s/class/classic/
|
NetApex |
Ahh, but it is something that isn't an on the fly thing though right?
|
Mark M. |
Neither is theirs
|
Mar 30 | 8:50 PM |
Mark M. |
after all, you downloaded the file
|
NetApex |
Yes, but you type in a link to say a youtube, facebook, funny or die... video or whatever and it feeds you the mp4 version back.
|
Mark M. |
Right
|
NetApex |
Never really looked at how it works behind the scenes
|
Mark M. |
I seem to recall there are some FLV downloaders
|
Mark M. |
regardless,
to try to use their site programmatically, you're going to have to
pretend to be a Web browser via HttpClient or something
|
NetApex |
ok, if anything, this will definitely be a learning experience.
|
Mark M. |
gonna be a bit icky
|
Mark M. |
not a straight-up form
|
Mark M. |
uses javascript for the submission
|
NetApex |
Heck, your vidtry app taught me a lot!
|
Mark M. |
Yeah, I'm kinda pleased how well that sample worked
|
NetApex |
Yeah I saw that part, the javascript will be a pain for me to make work
|
Mark M. |
Served me well when writing the first cut of the Howcast client
|
NetApex |
It's very impressive.. I just need to figure out what I did wrong when I put it in my app
|
Mar 30 | 8:55 PM |
NetApex |
the
video doesn't start moving the progress bar and you have to hit
pause/play after you already hit go before it starts playing. Minor
issue I suppose
|
Mark M. |
that's a bit odd
|
George S. |
Mark, where can we download the source code for your books?
|
Mark M. |
Visit the main Web site (http://commonsware.com), visit the page for the book in question, and look for the Source Code link
|
Mark M. |
It'll point you to my github page
|
George S. |
ok, thanks.
|
Mark M. | |
Mark M. |
everything is in a set of github repos
|
George S. |
great... I'm heading there now.
|
NetApex |
I should check and see if there are other websites out there that do the same thing with an easier interface
|
George S. |
That would be great.
|
NetApex |
Or heck.. figure out how they do that and make my own site.
|
George S. |
lol ya.
|
George S. |
Is there any other tidbits, gotchas you ran into that you have learned from. Like my main.this?
|
Mark M. |
Enough to fill three books :-)
|
Mark M. |
(with a fourth on the way)
|
George S. |
Write em!
|
Mark M. |
I already did
|
NetApex |
He has lol
|
NetApex |
And I am dying for the 4th!
|
NetApex |
I hope it includes Live Wallpaper!
|
George S. |
I need one that does just the main.this type goofy ones. lol
|
Mar 30 | 9:00 PM |
George S. |
a pocket guide maybe. lol
|
Mark M. |
No live wallpaper, sorry
|
Mark M. |
Fourth book is _Android Beyond Java_
|
Mark M. |
alternative app development frameworks (e.g., Phone Gap)
|
Mark M. |
scripting languages
|
Mark M. |
and the NDK
|
George S. |
ah, good the NDK.
|
NetApex |
Interesting!
|
Mark M. |
easy for you to say
|
Mark M. |
makefiles give me the cold sweats
|
George S. |
What do you think of the Corona SDK for Android announcement, heard of it?
|
Mark M. |
nope, doesn't ring a bell
|
Mark M. |
but, speaking of bells, it's time for this evening's chat to draw to a close
|
George S. |
Ya.. ansca mobile puts it out.
|
NetApex |
Ha! keepvid.com
|
NetApex |
Aww dang
|
George S. |
ah.. okay, thanks for your help.
|
NetApex |
lol, ok man.. thanks for the info as usual!
|
George S. |
good night all.
|
Mark M. |
goodnight!
|
George S. | has left the room |
NetApex | has left the room |
Mark M. | turned off guest access |