Feb 14 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Feb 14 | 9:25 AM |
Sean S. | has entered the room |
Mark M. |
hello, Sean!
|
Mark M. |
how can I help you today?
|
Sean S. |
hi Mark..
|
Feb 14 | 9:30 AM |
Sean S. |
...I've a question related to the SortedFragment example from the RecyclerView chapter of the Busy Coder's Guide.
|
Mark M. |
OK
|
Sean S. |
I note in the example that the SortedFragment instantiates a new IconicAdapter each time OnCreateView is called (following, for ex., an orientation configuration change.
|
Mark M. |
yes
|
Sean S. |
Won't the previously instantiated adapters (and presumably objects referencing them, such as the RecyclerViews) hang around in memory, given that each previous instance will have (being an inner class) an implicit reference to the retained SortedFragment?
|
Mark M. |
I don't think so
|
Mark M. |
the fact that the IconicAdapter has a reference to the fragment does not matter
|
Mark M. |
what would matter is if the fragment had a reference to the IconicAdapter
|
Sean S. |
ah, great...
|
Mark M. |
so, on a configuration change, nothing should have a reference to the old IconicAdapter anymore, so it should get garbage-collected
|
Feb 14 | 9:35 AM |
Mark M. |
briefly, I leak the old adapter, until onViewCreated() is called, as the fragment holds a reference to the most recent adapter
|
Mark M. |
but once that field is pointing to the new adapter, I don't know of any other references to the old adapter
|
Mark M. |
I can't rule out there being one that I am not thinking of
|
Sean S. |
yes, I see, and I also don't see any references to the adapter remaining. I got caught up with the notion that the implicit inner class reference (i.e. an IconicAdapter instance having an implicit reference to the retained Fragment instance that instantiated it) would play a role.
|
Mark M. |
where you get bit by those is when you hold onto the object with the implicit reference, forgetting about the implicit reference itself
|
Feb 14 | 9:40 AM |
Sean S. |
Right, I get it. It is good to get your feedback on this. Your approach has influenced my approach to a current development challenge.
|
Mark M. |
I try to be useful
|
Sean S. |
Thanks. Are you happy to take a general question related to licences and attributions (i.e. listing the licences / Notices / attributions for third party open source that has been built into a project)? No problem if it (the topic) is not suited to this forum.
|
Mark M. |
you can ask, but whether I can help you is another matter :-)
|
Sean S. |
Cool..it is only very general...
|
Feb 14 | 9:45 AM |
Sean S. |
..like many a developer before I am finding it difficult to find a definitive guide as to how I should include information (i.e. the licences, notices etc.) about the third party open source I am baking into my app. Mostly (possibly all) the open source is Apache 2.0. Do you know of anywhere online where the necessary steps are spelt out? Ultimately I'll just have to relent and try reading the actual Apache licence documentation itself.
|
Mark M. |
well, the license itself is not that long, and its documentation IIRC is not that bad
|
Mark M. |
AFAIK, the only time that attribution really comes into play is with a binary distribution (e.g., app distributed via the Play Store)
|
Feb 14 | 9:50 AM |
Mark M. |
there, somewhere, you're supposed to list the open source libraries and their licenses
|
Mark M. |
in one app that I am working on now, I am showing the library by name and showing the copyright notice and the "short form" of the license (basically, the prose that you see at https://github.com/commonsguy/cw-omnibus/blob/m...)
|
Mark M. |
there are third-party libraries that provide you an "about" activity or dialog that incorporate plugging in this sort of information
|
Mark M. |
in my case, I'm just putting it in HTML (Bootstrap 3) and showing it in a WebView
|
Sean S. |
sure...I have checked out the approach you took..My app will be destined for the Store. I guess I am unclear whether I need to provide attribution for the open source library's dependencies (for ex., I guess I need to track down the libraries something like Retrofit brings into my project as its own dependencies)?
|
Mark M. |
my personal interpretation is "no"
|
Mark M. |
however, IANALNDIPOOTV (I am not a lawyer, nor do I play one on TV)
|
Sean S. |
...interesting....and yes, I fully understand.
|
Mark M. |
in the end, the attribution bit is frequently ignored, on both sides
|
Mark M. |
for example, I really don't care whether anyone provides me with attribution for using my libraries
|
Feb 14 | 9:55 AM |
Sean S. |
Yep, sure....at the moment I am hoping to give it a good go (i.e. getting the attributions right), but I probably won't sweat it too much.
|
Sean S. |
Great stuff...this has been a great help. Many thanks Mark.
|
Mark M. |
you are very welcome!
|
Sean S. | has left the room |
Feb 14 | 10:00 AM |
Mark M. | turned off guest access |