« first day (1468 days earlier)      last day (3472 days later) » 

10:00 PM
Ok, I'm done for the day. cya tomorrow
 
cya
 
Ahmad!!!
I need answers!
 
what's up emmanuel?
answers?
 
look at the links I posted above
 
42
 
10:01 PM
^
thats it
case closed
 
if my reasoning is correct, even if you pass null to setOnClickListener() in onPause() you will still have that inner class floating around
 
just a min
let me switch to my desktop
 
what really needs to happen is that you need to store that inner class in a variable and set it to null in onPause() to prevent the leak, right?
or implement the interface at the class level
 
okay I'm here
reading up
Nope since nothing is holding a reference to it I assume it will just be garbage collected
 
I'd expect it ot get collectred since it's not attached to anything.
Oops, ^^
 
10:09 PM
that is if you pass null to setOnClickListener()`?
 
The JVM (or in this case dalvik or ART) is/are highly optimized
yeah
 
Yes, you sever the link.
 
but if you do not do that, you will create a leak
 
Once the view is collected the listener will too. Or should.
 
^
 
10:10 PM
Is it possible to add a header on a fragementList, did anyone of you achieve this?
 
it will not be collected
 
the view?
 
Not on Pause but after onDestroy()
When the ParentView (Fragment) or Activity is collected.
It will waterfall, am I missing something?
 
what I mean is that if you do not call setOnClickListenre(null) in onPause() you will create an Activity leak if your listener is an anonymous inner class
right?
 
Nope
 
10:12 PM
because the anonymous inner class holds a reference of the Activity
according to the article, that should be the case, right?
 
I need to actually read it :)
 
I think this all happens because anonymous inner classes hold an implicit reference to their enclosing scope
 
Butif the encloseing Scope (Activity) doesn't exist....
Also it's not bidirectional
AFAIK
 
it will not be GC'd because your inner class has a reference of it
 
ooh wait
 
10:15 PM
If I care about Strawberry, but Strawberry doesn't care about me, I get destroyed, right?
 
You're right
 
not on this case, I think
who is right? lol
 
you are
it will leak
this is really a tough one.
I don't know holding a reference to the anonymous class is the solution
 
From my understanding this all happens because the reference to the activity is being held by the handler which is being held by message queue or something else outside the activity lifecycle, an OnClickListener that only exists while the button exists probably wouldn't leak afaik.
 
Very interesting... I guess I was wrong. Good.
 
10:25 PM
Dave, you might be right there
that is what I was debating with a colleague
I think you are right
so this only applies to Handlers
 
I'll read up on the articles. Really interesting stuff.
 
so no need to set them to null
Handlers are the exception then, because they share the same MessageQueue
 
I wonder if there is anything used like that, that could also be held outside the activity life cycle.
 
now I am confused
another colleague argues that the Activity will not get GC'd
 
10:41 PM
My understanding is you should always use a WeakReference to store Context in a Handler.
 
that is understood
but what about if instead of a Handler it is an OnClickListener?
 
Aren't Activities actively deconstructed?
 
I'm not sure, but it wouldn't hurt to use a WeakReference...
 
They don't just get detached and left there to be reclaimed, do they?
 
It's not, but it should be one of the 10 Commandments of Android Programming, about WeakReferences and Handlers. Hmmm... I might have to tweak the list... kd7uiy.com/2014/02/the-10-commandments-of-android.html
 
10:45 PM
If I want to style the triangle of a Spinner - do I still have to create a drawable? There's no tint colour I can set on it or something?
 
isn't the OnClickListener held by the Button, which is held by the Activity, which holds the buttons? I'd think that as the Activity is released, so is the button, which releases the listener and it's reference to the activity. In the case of the Handler the handler is still being held by the MessageQueue which causes the Reference to the activity to persist even when it shouldn't
 
I think that is the case Dave
but I want to be 100% sure
I am going to ask Commonsguy on his office hours tonight
 
Oh, you got the subscription?
 
Let me know how it goes em
 
I will
I do nana
 
10:48 PM
Would you say it's worth it?
 
I think so
@DaveS I think this is an example of what you were asking
 
Wow, the new Chromium Depot_Tools took the fetch time wayyy down, From 5 hours to 1.5 hours!
 
lol since I'm moving phone and don't want to lose my whatsapp chats I tried to back them up
and it just didn't work
wanna guess why emmanuel?
 
LOL!
 
:D
 
10:56 PM
that means it works!
 
Ha Ha Ha
 
yeah definitely
 
I should add a feature to kill the Service
and restart it
 
yeah
something like an activate/deactivate switch
 
posted on October 23, 2014 by Tor Norbye

We've just released Android Studio 0.8.14 to the canary channel. This is just a bug fix release which addresses a few important issues in 0.8.13:Improvements to the AVD manager: more feedback when creating and starting AVDs; better default RAM device defaults, better system API sorting, tweak emulator launch parameters, and the emulator output is now displayed in an output tab (which is importa

 
10:59 PM
Ahmad, I thought you said feeds didnt work
did u fix?
 
@Emmanuel yeah that's interesting, all of this. So far though the only thing I had to change was the Handlers and I'm not sure they would leak since all our messages are just a few bytes with a short timeout.
 
Feeds work
the xkcd feed just doesn't work
 
Then whats event he point?! </joke>
 
hehe
 
Someone recommended a good looking IRC client but I uninstalled it because it kept crashing, If anyone remembers what it was that would be cool, they might of fixed the bugs.
 
11:17 PM
Hi
 
yo
 
Sup
 
meh
 
@noah it was probably me
 
Yep, it was you
I tried it, but it would just crash on start
*But, it didn't look horrible
 
11:24 PM
It doesn't really need to work as long as it doesn't look horrible
 
I just downloaded Lollipop and created an AVD. It takes soooooo much longer than KK to load.
 
*Its also an AVD
*Its also not a GeniMotion AVD
 
oh...there we go. Maybe I was trying to load a TV image instead of the regular Intel Atom image.
 
Ok, Well this time I connected to the server, THEN it crashed. A step in the right direction...
 
The message
 
11:37 PM
that's so yesterday
 
> so, if you were to put an OnClickListener in a static data member, that would leak the listener and anything it can reach
and so if that's an anonymous inner class, you'd leak the outer class (e.g., the activity or fragment that created it)
but, usually we don't put an OnClickListener in a static data member
^ the answer I got from Commonsguy
 
what's your Q?
 
the listener will not make the Activity leak
 
How do you create the listener?
uh oh, the AS updater is hung and bogging down my ocomputer
 
as an anonymous inner class
 
11:43 PM
then it will leak the activity/fragment. It has an implicit reference to an instance of the outer class.
 
it does not
 
I'm pretty sure that's how anon inner classes work
 
they do have a reference of the outer class
but the object gets dereferenced one the Button goes out of scope
 
so how is that not a leak?
 
59 mins ago, by Dave S
isn't the OnClickListener held by the Button, which is held by the Activity, which holds the buttons? I'd think that as the Activity is released, so is the button, which releases the listener and it's reference to the activity. In the case of the Handler the handler is still being held by the MessageQueue which causes the Reference to the activity to persist even when it shouldn't
this is not the case for Handlers
 
11:47 PM
posted on October 23, 2014 by Android Developers

By Katherine Kuan, Developer Advocate Updated material design Tumblr app on Nexus 6. Last week, we unveiled the Nexus 6 and Nexus 9, the newest additions to our Nexus family that will ship with Android 5.0 Lollipop. Together, they deliver a pure Google experience, showcasing fresh visual styles with material design, improved performance, and additional features. Let’s make sure your

 
hmm....maybe I need more context. Did you ask a Q on SO? Mind linking?
 
I didn't
we just were discussing it here
 
was commonsguy here?
> if you were to put an OnClickListener in a static data member, that would leak the listener
If you store the OnClickListener in a static variable, there will be a live reference long after the Activity and Button are destroyed
 
Jul 15 '11 at 19:38, by CommonsWare
have a pleasant day, all!
He was. A few years back.
But no, no he wasn't.
 
right, but I am not saying that we store it on a satic
 
11:50 PM
Whar's a mipmap?
 
just newing one up and pass it to setOnClickListener()
 
okay...the quote that you posted just after I joined said that, though.
 
Just installed Google's Messenger app, looks good and works on Kitkat
 
yah, if you pass it in directly, then there's no leak. The quote said "if it's in a static member then it causes a leak"
 
yeah, he was just giving an example of when you could generate a leak
 
11:52 PM
okay...
guess I missed part of the conversation, then...or misunderstood what I was reading after I joined.
 
Ahmad so what you're saying is that Room-15 still holds a reference to CommonsWare. I would have thought the GC would have picked it up by now...
2
 
PS I'm back because the entire way home I was trying to figure out if I'd been accidentally leaking my OnClickListeners this whole time
 
Lol MrEngineer
 
we've concluded no, as long as you aren't storing them as a static variable, which would be pretty silly.
 
11:55 PM
exactly
 
Also Emmanuel, I have the Warescription as well and I never realized that office hours were available. So thanks for that
 
whaaat
 
no problem
 
you're missing the best part of the CommonsWare subscription
 
Yea...Totally...storing them as static variables would be silly...
I have to go change my code...
 
11:55 PM
Also the SO bumping feature is awesome
 
I have seen people store references to all sorts of things in static vars
 
that reminds me...I have WareScription as well
static vars are evil!
 
true that!
Commonsware is online now, if you guys want to talk to him
 
I'd go online and ask him all sorts of silly questions
what's your favourite tv show
 
11:59 PM
I was just thinking that Ahmad!
 
why is iOS superior to Android
 
I do not think he will answer
 
Who?
 
he seems a bit weird, lol
 
I have a warescription also. All I've asked him was about the printing framework. And he told me he probably wouldn't get to that for awhile
 
11:59 PM
worth a try
 
After you mentioned asking him stuff at his office hours I noticed they were right now but I can't think of anything to ask.
 
only answers questions related to Android dev
 

« first day (1468 days earlier)      last day (3472 days later) »