Jul 13 | 8:20 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Russ | has entered the room |
Mark M. |
sorry about that
|
Russ |
Hi Mark
|
Russ |
It's ok!
|
Mark M. |
been one of those days...
|
Russ |
Am I really the only one here?
|
Russ |
I don't believe it
|
Mark M. |
well, the room just opened a few seconds ago, due
to my screwup
|
Russ |
My first time on campfire
|
Russ |
:)
|
Mark M. |
welcome here!
|
Russ |
So I guess I should jump up
|
Russ |
and ask my qustions
|
Mark M. |
go right ahead!
|
Russ |
I've prepared them...
|
Russ |
First off, I'd like to say thanks for being such a
generous person with your time for these chats. You provide a unique
service that has true value behind it!
|
Russ |
ok enough cheese (but its the truth)...
|
Mark M. |
I do what I can!
|
Russ |
View paste
|
Mark M. |
AsyncTask and Service are typically orthognal
|
Mark M. |
you can use them both
|
Russ |
should we?
|
Jul 13 | 8:25 PM |
Mark M. |
If you look at the service-related chapters in The
Busy Coder's Guide to Android Development, you will see where I use an
AsyncTask with a Service for HTTP operations
|
Mark M. |
in that case, it's a GET, not a POST, but the same
concept applies
|
Russ |
ok, he was playing with that tutorial earlier
today....
|
Mark M. |
whether or not you should use that pattern will
depend a bit on the trigger for the upload
|
Russ |
wanted to make sure it was the right thing to go
forward with
|
Mark M. |
is this based on user input, an alarm, or
something else?
|
Russ |
we will initiate the upload, and the webserver
will confirm
|
Russ |
input
|
Mark M. |
a Service with an AsyncTask can work fine for that
|
Russ |
sounds good, we will move forward with that...
|
Russ |
another question...
|
Mark M. |
another option is to use an IntentService, which
gives you work (in the form of Intents) on a background thread
|
Russ |
Another question is about images from the camera.
In the future, android devices will probably have ever-increasing
megapixel cameras. We want to limit the maximum image size from a
camera. Is there a way scale the images down in Android, and if so, can
you recommend a resource to where we can learn more about how to do
this?
|
Mark J. | has entered the room |
Russ |
ok lets place the 2nd question on hold..
|
Mark M. |
howdy, Mark J!
|
Russ |
which do you think i sbetter
|
Mark M. |
Russ: I'd start with the AsyncTask approach
|
Russ |
Hi Mark M
|
Russ |
:)
|
Mark M. |
Russ: let me take a question from Mark J, then we
can roll back for your 2nd question
|
Mark J. |
Heya Mark. Chatting from my nexus one.
|
Russ |
sure!
|
Mark M. |
Mark J: got a question? one that's type-able on a
soft keyboard, anyway?
|
Mark M. |
(BTW, are you using Campfyre, or the Browser?)
|
Jul 13 | 8:30 PM |
Mark M. |
Mark J: are you out there?
|
Mark M. |
ok, Russ, let me tackle your 2nd question while
Mark J tries to get reconnected or whatever...
|
Russ |
okay!
|
Russ |
i have plenty of patience
|
Mark M. |
BitmapFactory is what people use for scaling
images, AFAIK
|
Mark M. |
haven't had a need to fuss with that myself just
yet
|
Russ |
ok
|
Mark M. |
you can load an image in off a file using a
BitmapFactory.Options object
|
Mark M. |
there you can control scaling, sub-sampling, etc.
|
Russ |
thanks - I can look into it more now that I know
where to look :)
|
Russ |
I'd also like to ask about sounds on android
devices. I have a couple apps that play sounds, and apparently they
don't work on Samsung Moment phones (as well as the Cliq). Turns out,
those devices only support 8 Khz sounds, not 16. Am I stuck packaging 8
Khz sounds with all apps? Should I only use 8 Khz sounds (I'm not an
audiophile, so I really don't know). Is there a way to down-convert
when installed on an app and the device is identified as not supporting
16 Khz?
|
Russ |
(last question, BTW)
|
Mark M. |
yeah, you sure pack 'em in, though... :-)
|
Mark M. |
I have no idea regarding down-conversion
|
Russ |
:D
|
Jul 13 | 8:35 PM |
Mark M. |
I am perhaps less of an audiophile than you, so I
have no good sense whether 8 KHz will be significantly worse for your
users
|
Mark M. |
you could package both and choose based on device
model sniffing, I suppose
|
Mark M. |
I don't know how you can tell what's supported
more directly
|
Mark M. |
I do simple audio file playback -- haven't used
SoundPool or AudioTrack yet
|
Russ |
I have a simple sound players setup as
well...didn't know there was a problem until I started getting a lot of
one-star ratings for the problem. I may just go with 8 khz and be done
with it
|
Mark M. |
what are the sounds for? game effects?
|
Russ |
I'd rather not include multiple sets of audio
files, takes too much space
|
Russ |
No, just part of an app sounds. But my libs could
be used for games, I suppose
|
Russ |
I'd like to jump back to the first question, if
you don't mind
|
Mark M. |
go ahead
|
Russ |
it's an important one for my friend and I
|
Mark M. |
unless Mark J has returned -- you out there?
|
Russ |
Lost in the Android 'Nexus' ?
|
Mark M. |
I was guessing a really long tunnel :-)
|
Mark M. |
OK, Russ, go ahead
|
Jul 13 | 8:40 PM |
Kevin M. | has entered the room |
Russ |
You recommend an async task (Dealing With Threads
chapter), Communicating Via the Internet chapters, yes?
|
Kevin M. |
Hello
|
Russ |
hello kevin
|
Mark M. |
Russ: yes
|
Mark M. |
howdy, Kevin!
|
Kevin M. |
Let me know when I can ask a question
|
Russ |
go ahead, i've asked plenty already
|
Russ |
;-)
|
Mark M. |
Kevin: Russ has asked a few, and Mark J seems to
be having connection issues
|
Mark M. |
so go ahead!
|
Kevin M. |
Ok. I've got an music app that show a notification
|
Kevin M. |
When the user selects the notification, it starts a
new activity and can cause 2 files to play at the same time
|
Mark M. |
is that your goal?
|
Kevin M. |
Is there any way to show the current music
activity?
|
Mark M. |
yes
|
Mark M. |
hold on while I look up the recipe...
|
Kevin M. |
It's actually for podcasts that get downloaded
|
Mark M. |
when you create your Intent for your
PendingIntent, call
setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP)
on the Intent
|
Mark M. |
if your activity is still going, this will take
the user back to it
|
Jul 13 | 8:45 PM |
Mark M. |
the activity will receive onNewIntent() instead of
onCreate()
|
Jul 13 | 8:45 PM |
Kevin M. |
Great. I was trying to make the 2 activities
singleTop
|
Mark M. |
(in case your activity needs to be aware that this
all occurred)
|
Mark M. |
yeah, where possible, you're better off using
Intent flags -- more fine-grained
|
Mark M. |
you'll see this in Android Programming Tutorials,
Tutorial 20
|
Kevin M. |
So I should leave the activities as regular
activities then?
|
Mark M. |
yes
|
Mark M. |
no need for special settings in the manifest
|
Kevin M. |
Ok. One other question: I've managed to get a
floating window up but am having problems getting touch events to the
buttons on that window
|
Mark M. |
what do you mean by "floating window"
|
Mark M. |
?
|
Kevin M. |
I copied some of the mediacontroller window's
code. It floats above the activity
|
Mark J. |
Okay sorry, I have returned :P. (Campyre didn't
work too well
|
Mark M. |
Mark J: welcome back! I'll be with you momentarily
|
Kevin M. |
What happens is when the user touches the screen,
the float control window comes up
|
Mark J. |
Alrighty :)
|
Kevin M. |
I'm overriding dispatchTouchEvent and trying to
manipulate the position of the event
|
Jul 13 | 8:50 PM |
Mark M. |
that sounds scary
|
Russ |
:O
|
Kevin M. |
Well, it seems necessary
|
Mark M. |
doubtful
|
Kevin M. |
I've got it mostly working
|
Mark M. | |
Kevin M. |
Have you managed to do this?
|
Mark M. |
I have some popup panels in this app, and buttons
placed in those panels behave normally, without any mods to touch events
|
Kevin M. |
I've got that code
|
Mark M. |
also, MediaController does not override
dispatchTouchEvent()
|
Mark M. |
you can see the source code through Google Code
Search
|
Mark M. | |
Mark M. |
package:android MediaController
|
Kevin M. |
It doesn't seem that my buttons are getting
clicked
|
Mark M. |
you might also look at http://github.com/jgilfelt/android-mapviewballoons
|
Mark M. | |
Mark M. |
to see how they do theirs
|
Kevin M. |
Ok. I'll take a look at those. Which files?
|
Mark M. |
beats me
|
Mark M. |
I just have the projects bookmarked as things I'd
like to make a bit more general-purpose someday
|
Mark M. |
beyond that, it's tough to give you specific
advice
|
Jul 13 | 8:55 PM |
Kevin M. |
It was kind of interesting. I created a Dialog and
got the window from that class as it doesn't seem like you can create a
window
|
Mark M. |
see PopupWindow, though I haven't tried that yet
|
Mark M. |
I tend to embed them just in the layout, making
them VISIBLE or GONE as needed
|
Kevin M. |
Didn't even know that existed!
|
Mark M. |
OK...Mark J -- you still with us?
|
Mark J. |
Yes :)
|
Mark M. |
got a question?
|
Mark J. |
Yep :)
|
Russ |
nexus keyboards are slooooow.... ;)
|
Mark J. |
Its not as complex as the last ones; I have an
ArrayAdapter in a list, and I am able to make new entries into it. But
how am I able to Save the information from the list, so that if I
restart the activity, the old information is still there
|
Mark J. |
Sorry, Not on my Nexus anymore :P
|
Mark M. |
what scenario(s) are you considering "restart the
activity"?
|
Mark M. |
user presses BACK?
|
Mark M. |
user rotates the screen?
|
Mark M. |
user drops phone, battery pops out?
|
Mark M. |
other?
|
Mark J. |
All :)
|
Mark M. |
I'd get rid of the ArrayAdapter and move your data
into a persistent store, probably a SQLite database
|
Mark J. |
How can I save the ArrayAdapter/Arraylist
|
Mark J. |
Well, just for more detail. Its just a basic
checklist
|
Jul 13 | 9:00 PM |
Mark J. |
Or atleast what I am trying for
|
Mark M. |
that really sounds like a SQLite database
|
Mark M. |
columns for name and checked/not-checked state
|
Mark M. |
plus the obligatory _id column for CursorAdapter
|
Mark J. |
Okay, book section I should refer to?
|
Mark M. |
you'll see how I move an application from an
ArrayAdapter to a CursorAdapter and database in Android Programming
Tutorials
|
Mark M. |
Tutorial 11, specifically
|
Mark J. |
In APT?
|
Mark M. |
general database usage is covered in the Database
chapter of The Busy Coder's Guide to Android Development
|
Mark M. |
Tutorial 11 is in Android Programming Tutorials,
yes
|
Mark J. |
Okay
|
Mark J. |
Thanks man. I will check them out
|
Mark J. |
That answers my question
|
Russ |
One last one from me?
|
Mark M. |
go ahead
|
Russ |
I keep getting emails from people who want me to
sell my apps on their sites. I haven't responded to any of them and
wanted to get your thoughts on this.
|
Mark M. |
well, you'd want to research how good their reach
is, to see if it's worth the hassle
|
Mark M. |
Google 'em and see what turns up
|
Russ |
i thought we could only sell apps on the market
|
Mark M. |
on the whole, I have not heard of any independent
market that is doing great business
|
Mark M. |
oh, no
|
Mark M. |
you can sell them anywhere
|
Mark M. |
SHOP4APPS (Motorola), AndAppStore, etc.
|
Russ |
but users have to check install non-market apks
then, correct?
|
Mark M. |
yes
|
Mark M. |
which means AT&T users are kinda hosed
|
Jul 13 | 9:05 PM |
Russ |
thanks, then answers my questions - you've been a
big help today - thanks alot
|
Mark M. |
that's why I'm here
|
Russ |
:)
|
Kevin M. |
Thank you too!
|
Mark M. |
OK, I'm going to wrap this up for the evening
|
Russ |
Take care
|
Mark M. |
(or whatever appropriate time of day it is for
wherever you are)
|
Mark M. |
see you later!
|
Russ |
8:05 AM :)
|
Mark J. |
6:05PM :)
|
Russ | has left the room |
Mark J. | has left the room |
Kevin M. | has left the room |
Mark M. | turned off guest access |