Apr 5 | 7:50 PM |
Mark M. | has entered the room |
Apr 5 | 7:55 PM |
Mark M. | turned on guest access |
Mark M. | turned off guest access |
Mark M. | turned on guest access |
Apr 5 | 8:00 PM |
Suzanne A. | has entered the room |
Suzanne A. |
hey Mark
|
Mark M. |
howdy, Suzanne!
|
Suzanne A. |
Hallo! Danke!
|
Suzanne A. |
I'm-a building my first fragment example
|
Mark M. |
Berlin?
|
Suzanne A. |
yessir
|
Suzanne A. |
With a GridView of photos in the left pane, and soon one large photo in the right
|
Suzanne A. |
Both fragments are subclasses of Fragment
|
Suzanne A. |
What is the best way to pass the image index from the grid fragment to the photo fragment?
|
Mark M. |
well, ideally, fragments don't talk directly to each other
|
Mark M. |
after all, you might remix matters for other screen sizes, and so they might not both be in memory at once
|
Suzanne A. |
okay. what is the best way to display the photo?
|
Mark M. |
the way I approached it, following Ms. Hackborn's
recommendation, was to have events flow from the fragment to the
activity via a listener interface
|
Suzanne A. |
oh. do you have an example?
|
Mark M. |
the hosting activity will need to know how to get
the event to the other fragment -- if they're both hosted by that same
activity, that's easy, of course
|
Mark M. |
hang on
|
Mark M. | |
Mark M. |
from the latest _The Busy Coder's Guide to Android Development_ (Version 3.6, out for a week or so)
|
Suzanne A. |
okay, got it
|
Suzanne A. |
is there a specific place in EU4You6>
|
Suzanne A. |
?
|
Marco G. | has entered the room |
Marco G. |
hello, can I ask a question?
|
Apr 5 | 8:05 PM |
Mark M. |
well, the EU4You activity will host the CountriesFragment and also the DetailsFragment for large screens
|
Mark M. |
Marco G: please hold on a bit, while I get Suzanne squared away
|
Marco G. |
Sorry, I'll wait my turn
|
Mark M. |
Suzanne: when the user clicks a country in the CountriesFragment, it passes the URL to be displayed to the EU4You activity
|
Mark M. |
in large/xlarge screens, that will trigger EU4You to call a method on DetailsFragment
|
Mark M. |
in small/normal screens, that will trigger EU4You to start up a DetailsActivity which will hold the DetailsFragment
|
Suzanne A. |
ah, onDetailsFragment
|
Mark M. |
activities turn into an orchestration layer in Fragmentland
|
Suzanne A. |
right. so I have to build the event handling mechanism ...
|
Mark M. |
which is mostly an interface for the event, and having the activity implement that interface
|
Mark M. |
so the event source fragment can let the activity know about the event, and the activity has to figure out how best to do that
|
Suzanne A. |
okay. I'll look at DetailsActivity and DetailsFragment
|
Mark M. |
both are pretty thin classes, IIRC
|
Suzanne A. |
and CountryListener
|
Suzanne A. |
thin is good at times like these :-)
|
Apr 5 | 8:10 PM |
Mark M. |
and your copy of the book is waiting your download
|
Suzanne A. |
danke (again)
|
Mark M. |
no problem
|
Mark M. |
Marco: your turn!
|
Mark M. |
or anyone with a question, at this point
|
Marco G. |
I have to represent graphically a tree structure..
I've asked few days ago in android-developers mailinglist and i've got
some replies, but I want also ask to you what do you think is the best
way to do
|
Erdal | has entered the room |
Marco G. |
others have done it customizing expandablelistview
|
Mark M. |
do you have a link to the android-developers discussion? I may as well catch up with that first
|
Marco G. | |
Mark M. |
(btw, howdy, Erdal!)
|
Erdal |
hey guys!
|
Erdal |
hey Mark
|
Erdal |
can we just ask our questions here?
|
Marco G. |
I would ask to you if there is something like a
multi levels textview in the APIs (just like a file manager) or if i
have to implements this levels
|
Marco G. |
*these
|
Mark M. |
Erdal: I'm on a lousy connection, so I'm trying to tackle questions one at a time
|
Erdal |
sure
|
Mark M. |
well, to be honest, I think the right answer is not to do it
|
Mark M. |
your example of a file manager, I would do one ListActivity to represent a directory
|
Mark M. |
showing its folders and files
|
Mark M. |
clicking on a folder would open up a ListActivity on it
|
Apr 5 | 8:15 PM |
Mark M. |
in a Honeycomb style, if you do it via fragments, you can choose to have a nice flow, akin to Finder in OS X
|
Apr 5 | 8:15 PM |
Mark M. |
yet still have something finger-friendly on phones
|
Mark M. |
I am not a big fan of tree structures on phone screens
|
Mark M. |
As TreKing put it, "You probably don't want to nest too deeply anyway considering the screen limitations on mobile devices. "
|
Marco G. |
the file manager was a generic tree structure
example, I was wondering if there is something that can feed my tree and
output such structure with listviews or similar
|
Mark M. |
not really
|
Mark M. |
I think that android-developers thread covered the ground fairly well
|
Marco G. |
so you suggest to do a ListActivity or something for each tree level and implements the navigation?
|
fitz | has entered the room |
Mark M. |
if I were starting from scratch today, I would use ListFragments, to make it easier to do something nice on tablets
|
Mark M. |
but, yes, ListActivity or ListFragments would be my approach
|
Marco G. |
ok, I'll ask if we can go straight to honeycomb.. but i don't think so.. I must take a look to compatibility library also
|
Marco G. |
thank you Mark
|
Mark M. |
yes, the compatibility library should cover this
|
Mark M. |
Erdal: your turn!
|
Marco G. |
oh great
|
Mark M. |
(btw, howdy, fitz!)
|
fitz |
Howdy :)
|
Erdal |
thanks
|
Erdal |
I'm working on an IM app
|
Apr 5 | 8:20 PM |
Erdal |
I have a Service that tries to maintain a TCP connection to my server
|
Erdal |
something similar to this: http://devtcg.blogspot.com/2009/01/push-se…
|
Erdal |
now everything seems to work fine until the phone goes to a hard sleep I think
|
Erdal |
I am trying to acquire a partial cpu wake lock
|
Erdal |
and release it when waiting for data
|
Erdal |
a normal log looks something like this:
|
Erdal |
View paste
|
Erdal |
then I process data inside my app
|
Erdal |
and then
|
Erdal |
View paste
|
Erdal |
but then the phone goes to deep sleep (I think) I see this in the logs
|
Erdal |
View paste
(10 more lines)
|
Erdal |
...
|
Erdal |
notice the interval is every 5 mins which is the same as my keep alive interval
|
Erdal |
but the weird thing is I don't see any other logs coming from my app
|
Mark M. |
the interval is not every 5 minus
|
Mark M. |
er, minutes
|
Mark M. |
at least not in that log segment
|
Mark M. |
some are little more than a second apart
|
Erdal |
hm you're right
|
Erdal |
sometimes it was
|
Erdal |
yes
|
Erdal |
you're right sometimes it is very close
|
fitz |
Mark have you started to use IntelliJ yet? I get
your examples to run in Eclipse and having a bit of a time getting the
examples to run i IntelliJ - do you know if IntelliJ runs Motorola
plugins? that is next on to-do.... to long of a list ahhh - I need to
jet so just answer me direct via email or here and I will check these
notes later tonight thanks
|
Apr 5 | 8:25 PM |
fitz | has left the room |
Mark M. |
Erdal: I really don't recommend that you try to keep the WiFi connection
|
Mark M. |
hard on the battery
|
Erdal |
actually I am acquiring a cpu wake lock
|
Erdal |
but the log says Wifi for some reason
|
Erdal |
I do this:
|
Erdal |
View paste
|
Erdal |
I also have a wifi lock that I hold while sending
|
Mark M. |
actually, you're not acquiring the WakeLock in that code snippet
|
Mark M. |
you need to call acquire()
|
Mark M. |
and, later, call release()
|
Erdal |
yes I do
|
Erdal |
that is just the setup
|
Apr 5 | 8:30 PM |
Mark M. |
it would seem to make sense that your WifiLock is what is causing the WifiLock log entries
|
Marco G. | has left the room |
Erdal |
yes
|
Erdal |
I will double check that
|
Erdal |
but my alarms aren't firing either
|
Erdal |
I used the wakeup one
|
Erdal |
for sendig keep alives
|
Mark M. |
are you sure that they're not firing, or just that your results are not happening?
|
Mark M. |
what sort of PendingIntent are you using for the alarms?
|
Erdal |
View paste
|
Erdal |
I have a class called Alarms
|
Erdal |
it's registered in the manifest as a receiver
|
Mark M. |
have you put in logging statements to confirm if onReceive() of Alarms is getting control on your scheduled times?
|
Erdal |
yes
|
Erdal |
I have a log in onReceive
|
Erdal |
I see that log usually, but not when the phone goes to sleep
|
Erdal |
I think it is sleeping
|
Erdal |
there is no good way of knowing when the phone will go to sleep afaik
|
Mark M. |
can you show me your call to setRepeating()?
|
Apr 5 | 8:35 PM |
Erdal |
sure the whole method is this
|
Erdal |
View paste
(3 more lines)
|
Mark M. |
and you'
|
Mark M. |
and you're sure that repeating is true?
|
Erdal |
yes because I call it like this
|
Erdal |
View paste
|
Mark M. |
then I don't know what to tell you
|
Mark M. |
nothing seems out of place
|
Erdal |
yea it's very strange
|
Erdal |
but when the phone goes to deep sleep the logs should still appear right?
|
Erdal |
it's not like logging is disabled when that happens??
|
Mark M. |
well, nothing should appear until the phone wakes up due to the alarm
|
Erdal |
yes during the alarm
|
Mark M. |
that's the whole point of sleep mode
|
Mark M. |
once the alarm goes off, everything in onReceive() of Alarms runs under a WakeLock managed by AlarmManager
|
Erdal |
yes
|
Mark M. |
if you acquire your own WakeLock in that period,
you can keep the device awake past onReceive() -- this is what I do in
WakefulIntentService
|
Erdal |
at the top of onReceive I have a log
|
Erdal |
yes I saw that one
|
Erdal |
pretty useful
|
Erdal |
because I wasn't acquiring one
|
Erdal |
before calling startService
|
Erdal |
and so after that I thought I solved my problems
|
Erdal |
but something is still not right
|
Apr 5 | 8:40 PM |
Mark M. |
again, I don't know what to tell you
|
Mark M. |
sorry!
|
Suzanne A. |
may I ask another question?
|
Mark M. |
you're still awake?
|
Suzanne A. |
yessir
|
Mark M. |
but go right ahead!
|
Erdal |
actually reading this:
|
Erdal |
If your application wants to allow the delivery
times to drift in order to guarantee that at least a certain time
interval always elapses between alarms, then the approach to take is to
use one-time alarms, scheduling the next one yourself when handling each
alarm delivery.
|
Erdal |
from the AlarmManager class
|
Suzanne A. |
best practices for downloading large numbers of images from the web effectively?
|
Erdal |
maybe my alarms are drifting
|
Erdal |
and so I should use one-time alarms that schedule the next ones
|
Mark M. |
Suzanne: best practices in terms of what?
|
Suzanne A. |
how to optimize performance?
|
Suzanne A. |
or is this question too vague?
|
Mark M. |
Suzanne: it's a little vague, yes.
|
Mark M. |
performance in terms of CPU? RAM? Bandwidth?
|
Mark M. |
Erdal: I doubt that's your problem
|
Suzanne A. |
ah, I'd probably say cpu
|
Mark M. |
does the download need to continue even if the user bails out of the activity?
|
Suzanne A. |
for this question, i'd say no
|
Apr 5 | 8:45 PM |
Mark M. |
OK, then it sounds like an AsyncTask, or possibly several
|
Mark M. |
right now, AsyncTask works off of a thread pool, so you could try downloading some simultaneously
|
Suzanne A. |
oh good, a thread pool - that helps me
|
Mark M. |
you'd have to experiment to see when too many background threads start to drag things down, though
|
Suzanne A. |
okay, will do
|
Suzanne A. |
thanks, mark - see you soon
|
Suzanne A. | has left the room |
Mark M. |
replies to fitz' queued up questions: no I have
not experimented with importing my projects into IDEA 10, and IDEA 10
does not run the MOTODEV Studio plugins, as they are Eclipse-specific
|
Mark M. |
feel free to ask on the [cw-android] Google Group
with respect to the IDEA 10 import problems -- without symptoms, I can't
provide advice
|
Mark M. |
any other questions?
|
Apr 5 | 8:55 PM |
Mark M. |
ok, well, have a pleasant day!
|
Erdal | has left the room |
Mark M. | turned off guest access |