Sep 8 | 3:50 PM |
Mark M. | has entered the room |
Sep 8 | 3:55 PM |
Mark M. | turned on guest access |
MyWay | has entered the room |
Mark M. |
hello, MyWay!
|
MyWay |
Hello Mark!
|
Sep 8 | 4:00 PM |
Mark M. |
how can I help you today, that doesn't involve Jack? :-)
|
Sep 8 | 4:00 PM |
MyWay |
I'm not just playing with jack unfortunately for you :P
|
MyWay |
eheh
|
MyWay |
I'm extending ArrayPagerAdapter with my class MyPagerAdapter and overriding some method, e.g. @Override public void add(PageDescriptor desc) { super.add(desc); }
|
Paul R. | has entered the room |
MyWay |
On my activity I'm building the adapter onCreate(...) like this:
|
MyWay |
View paste
|
Mark M. |
(BTW, hello Paul, I will be with you shortly!)
|
MyWay |
For some reason, I have some user getting NullPointerException caused by entries (the array you use inside ArrayPagerAdapter) being null, inside validatePageDescriptor(...) which is called e.g. after add(...). My question is... how is it possible that it's null? If MyPagerAdapter instance was null, than it'd have to stop before, on myPagerAdapter.add() call, so I suppose it's not. But as I'm just calling super(mgr, descriptors); in my constructor I can't understand the reason of getting this exception.
|
MyWay |
I'm not able to understand how it can be null sometimes
|
Mark M. |
off the top of my head, I can't answer that
|
Mark M. |
are you using the adapter for native fragments or the support-v4 backport?
|
MyWay |
native
|
MyWay |
onCreate I instantiate it and then magically, even if MyPagerAdapter instance is not null, some user get that NullPointerException
|
Mark M. |
well, I only assign values to entries in three places
|
Mark M. |
two of them are creating new ArrayList instances
|
Mark M. |
the third is in restoreState()
|
MyWay |
infact restore is called on the stack I get from firebase
|
MyWay |
but I can't understand the reason
|
Mark M. |
so, possibly the saved instance state is getting whacked
|
Mark M. |
or, the custom Parcelable is causing issues
|
Mark M. |
I assume from your phrasing that you aren't able to reproduce this in the lab
|
MyWay |
oh, then it could be possible that this issue is related to Parcelable one
|
MyWay |
yes, I wasn't able to
|
Sep 8 | 4:05 PM |
Mark M. |
there's not a lot that I can do for you here
|
Mark M. |
you might consider filing an issue on the repo, with the stack trace and other relevant evidence
|
Mark M. |
I'm not sure I'll be able to do a lot there either
|
Mark M. |
but, I'll at least have more ammo
|
MyWay |
keep in mind that in all these months I've never seen this issue reported
|
MyWay |
and now with the Parcelable one, maybe I'm getting this too
|
Mark M. |
well, I'm happy to blame Jack :-)
|
MyWay |
eheh
|
MyWay |
I'm getting crazy with it
|
Mark M. |
let me take a question from Paul, and I'll be back with you shortly
|
Mark M. |
Paul: your turn! do you have a question?
|
MyWay |
a lot of problems and I can't find any documentation
|
MyWay |
sure, sorry :)
|
Paul R. |
I do. three of them actually. The first is that since I noticed chat transcripts are available, how can we use them to our advantage. Do you have some suggestions?
|
Mark M. |
um
|
Mark M. |
well, you could always do a site-specific search on Google, using site:commonsware.com
|
Mark M. |
by volume, most of my site are the chat transcripts and my blog
|
Lefko | has entered the room |
Mark M. |
but, beyond that, I don't really have any particular ideas
|
Paul R. |
ok, 2) when developing open source apps, does Proguard obfuscation make any sense?
|
MyWay |
or maybe adding inurl: too? if there is something in the url of the transcript
|
Lefko |
Hello everyone!
|
Mark M. |
(hi, Lefko -- I will be with you shortly!)
|
Lefko |
sure. thanks
|
Sep 8 | 4:10 PM |
MyWay |
hello Lefko
|
Mark M. |
Paul: I don't think that obfuscation is worthwhile in an open source app
|
Lefko |
hey my way
|
Luca P. | has entered the room |
Mark M. |
frankly, I don't think that obfuscation is worthwhile in general
|
Mark M. |
(hello, Luca -- I will be with you shortly, after Lefko!)
|
Paul R. |
Good answer. Last question, and the most complicated. I am using managed fragments in an app to build a hierarchy (short one).
|
Paul R. |
I traverse the fragments using the back button and it works perfectly.
|
Paul R. |
But when I background the app and then foreground it, the hierarchy is displayed at the top, not where the User last left off. Clear picture?
|
Mark M. |
I do not understand what "the hierarchy is displayed at the top" means
|
Mark M. |
do you mean that the activity returns to the root fragment of your hierarchy?
|
Paul R. |
There are three fragments in the hierarchy. Call them groups, rooms and messages. Groups is at the top.
|
Paul R. |
If I am seeing messages and then background, when I return to the app I see groups.
|
Paul R. |
More clear?
|
Mark M. |
yes
|
Sep 8 | 4:15 PM |
Mark M. |
if the user is in messages, presses HOME, returns to the app, sees groups, and presses BACK, what happens?
|
Mark M. |
does the user see messages? does the activity get destroyed? or something else?
|
Mark M. |
let me take questions from the others, and I will swing back to you in a bit
|
Paul R. |
The app goes to groups and then shows rooms on a back press. Then exits, probably due to an NPI
|
Paul R. |
NPE
|
Mark M. |
Paul: that sounds like you replaced messages with rooms -- see if you have a FragmentTransaction that does a replace() for a RoomsFragment
|
Mark M. |
(or whatever you call it)
|
Mark M. |
and I'll be back with you in a bit
|
Mark M. |
Lefko: your turn! do you have a question?
|
Lefko |
yes. thanks
|
Lefko |
In the book you mention that you have a gradle script for uploading artifacts to amazon s3.
|
Lefko |
I have been struggling for a few days to get this working properly.
|
Mark M. |
actually, I have a shell script for uploading artifacts to Amazon S3
|
Lefko |
ahh
|
Mark M. |
it just uses Amazon's AWS CLI utility
|
Lefko |
Im not so familiar. Ill ask our devops guy
|
Lefko |
but let me ask you
|
Lefko |
do you know if the repo needs to have a pom.xml
|
Lefko |
or is it enough if I got the aar there?
|
Paul R. |
I have a gradle script for that, but i'll have to dig it up and send it to you.
|
Mark M. |
there are two separate steps that I do when I publish a CWAC library
|
Sep 8 | 4:20 PM |
Lefko |
that would be awesome paul
|
Mark M. |
first, I use gradle uploadArchives, which "uploads" my artifact and its generated POM to a local repo on my hard drive
|
Mark M. |
then, I use the shell script to slighly modify that local repo (adding in some stuff that S3 needs) and syncing it with S3
|
Paul R. |
While you chat with Mark, I'll try to chase it down.
|
Mark M. |
the uploadArchives step creates the POM, based on your Gradle configuration
|
Mark M. |
so I don't have a pom.xml in my repo
|
Mark M. | |
Mark M. |
that's the stanza from my library module's build.gradle file that I run, though a lot of that (the libraryVariants loop) is to prepare plain JARs for those who need them
|
Mark M. |
so really https://github.com/commonsguy/cwac-pager/blob/m... is a better highlight
|
Mark M. |
the constants you see there (e.g., PUBLISH_GROUP_ID) come from gradle.properties, which is not checked into the repo
|
Mark M. |
now, my approach is probably fairly non-standard
|
Mark M. |
there may be cleaner ways to do this now
|
Mark M. |
but, it's working, and so it suffices for now
|
Lefko |
ok thanks. Ill hope that Paul can find his script and if not play with it some more
|
Paul R. |
View paste
|
Sep 8 | 4:25 PM |
Mark M. |
that's interesting -- didn't know that mavenDeployer recognized s3:// URLs
|
Lefko |
darn, I need one that accepts s3 credentials
|
Paul R. |
You have to provide the secret bits of course in your environment.
|
Mark M. |
that's the same as with the command-line interface (CLI) that I use
|
Paul R. |
Or at least that's what I do.
|
Mark M. |
Lefko: while you ponder all this, let me take questions from the others, and I'll be back with you in a bit
|
Mark M. |
Luca: sorry for the wait! how can I help you today?
|
Luca P. |
Hi Paul, thanks for your time
|
Luca P. |
only one question:
|
Luca P. |
what do yo think about studying third party libraries like Retrofit, GSON, Picasso from a point of view of a beginner? Is it a good path to follow?
|
Mark M. |
by "studying", do you mean looking at how to use them, or how they were written?
|
Luca P. |
I mean using them in a real project
|
Mark M. |
certainly using them is a fine thing
|
Mark M. |
I would not recommend that a beginner try to understand how they work, as all three of those are fairly complex
|
Mark M. |
(Gson in particular)
|
Mark M. |
but understanding how to use them is perfectly reasonable
|
Mark M. |
it's why I cover Retrofit and Picasso in my book
|
Luca P. |
Ok good. Thanks so much
|
Lefko |
View paste
|
Mark M. |
Lefko: yeah, I haven't tried setting up AWS in Gradle itself, so I won't be of much use to you there
|
Lefko |
ok thanks anyway, and thanks for a great book!
|
Sep 8 | 4:30 PM |
Mark M. |
thanks!
|
Mark M. |
MyWay: your turn! do you have another question?
|
Lefko | has left the room |
MyWay |
I'm fine; thank you, Mark
|
Luca P. | has left the room |
Mark M. |
OK, if you come up with another question, let me know
|
MyWay |
sure, thanks
|
Mark M. |
Paul: back to you! do you have another question?
|
Paul R. |
I would rephrase my issue as: how should I manage fragments using a backstack across the lifecycles?
|
Mark M. |
well, that should be taken care of for you already
|
Paul R. |
How so?
|
Mark M. |
the big thing is to not accidentally do something yourself to disturb matters
|
Paul R. |
Ah. That begins to make some sense.
|
Mark M. |
well, by "across the lifecycles", and given your earlier question, I assumed that you are referring to pause/stop/start/resume from the activity being moved to the background and then the foreground
|
Mark M. |
in which case, the activity is still intact, with all its fragments
|
Paul R. |
yes.
|
Mark M. |
but, if in, say, onStart(), you run a FragmentTransaction, then that will upset the proverbial apple cart
|
Mark M. |
even if we undergo a configuration change, and the activity is destroyed and recreated, the fragment back stack should be intact
|
Paul R. |
And that, sort of, is what is happening.
|
Mark M. |
um, which that is "that"? :-)
|
Sep 8 | 4:35 PM |
Paul R. |
I think I can take a new tack to avoid the fragment transaction.
|
Mark M. |
OK
|
Paul R. |
The problem is that I shut down listeners when pausing and then restore them when resuming. Some listeners (Firebase) will kick off a authentication change which in turn changes the fragment.
|
Mark M. |
oh, yeah, that doesn't sound good
|
Paul R. |
I will focus on that. Thanks for your help.
|
Mark M. |
BTW, nowadays, consider switching to onStart()/onStop(), due to multi-window
|
Mark M. |
you will be paused while your activity is visible/foreground, but the user is tapping on the other pane of the split-screen, for example
|
Paul R. |
Can you tell me how far back (API level) multi-window gets supported in?
|
Mark M. |
it's new to Android 7.0
|
Paul R. |
I'm guessing not very far. :-)
|
Mark M. |
so that's API Level 24
|
Mark M. |
which is to say, roughly 0.0% of Android devices at the moment
|
Paul R. |
:-)
|
Mark M. |
but it's something to keep in mind
|
MyWay |
is there something that we have to keep inside onResume()/onPause()?
|
Mark M. |
onResume()/onPause() would be for things that you want to not have running while you are not receiving user input
|
Mark M. |
or for things that are so expensive that you want to be more aggressive about shutting them down
|
Paul R. |
Yes, I need to keep eventing for Firebase and the EventBus shut off.
|
Sep 8 | 4:40 PM |
Mark M. |
so, for example, a video player should keep playing through onPause(), and stop playback in onStop()
|
MyWay |
in my case, I can move eventbus too, because if the app is paused and there is multi-window
|
Paul R. |
The EventBus distributes events across the app. Firebase uses it's own events to manage the database.
|
MyWay |
the user can still see messages, right Mark?
|
Mark M. |
if your messages are displayed in your activity, then yes
|
MyWay |
yes
|
Mark M. |
so, for example, a Twitter client should keep updating its timeline through onPause(), only considering shutting some of that down in onStop()
|
Mark M. |
however, if Twitter had some stupid continuous animation effect going on all the time, *that* you might stop in onPause(), as it is non-essential and consumes power
|
Mark M. |
(not to mention the whole "stupid" part)
|
Mark M. |
(and note that I don't use Twitter on mobile, so this is a fictionalized example)
|
Mark M. |
(also, parentheses are fun!)
|
MyWay |
eheh
|
Mark M. |
OK, free-for-all time -- if either of you have a question, go right ahead
|
Paul R. |
I'm all set and chomping at the bit to fix my app. Enjoy, and talk to you soon.
|
Mark M. |
sounds good!
|
Paul R. | has left the room |
Sep 8 | 4:45 PM |
MyWay |
I'm using Firebase Crash reporting but it's beta and it's visible it is
|
MyWay |
you can't hide fixed bugs and nothing
|
MyWay |
(hide/close)
|
MyWay |
and when you increment your app version number, you can't upload the ProGuard mapping file until you get a report
|
Mark M. |
sounds like it needs work
|
MyWay |
but then, you can't see this trace :P
|
MyWay |
and you have to wait the next report
|
MyWay |
yes
|
MyWay |
I tought it was mature, even if beta, but it's not
|
MyWay |
and with Jack I had a lot of problems, I still can't shrink
|
MyWay |
eheh
|
Sep 8 | 4:50 PM |
MyWay |
I'm hoping for Android Studio 2.2 final and gradle plugin
|
MyWay |
then I don't think I'm going to move from stable for a bit :P
|
Mark M. |
well, Studio is on 2.2 RC right now, so I would assume it'll hit the release channel soonish
|
MyWay |
yes
|
MyWay |
oh, and you have no alert of new exceptions on Firebase, so you have to pull yourself!
|
Sep 8 | 4:55 PM |
Mark M. |
hopefully, at least its free
|
MyWay |
there is a free version and an upgrade version if I remember good
|
MyWay |
but I didn't look at it
|
MyWay |
I think they give you test-devices and other things with the paid one
|
Mark M. |
ah
|
MyWay |
so their cloud
|
MyWay |
well Mark, thank you very much for everything, I'll let you know about jack! :P
|
MyWay |
have a good day
|
Mark M. |
you too!
|
Sep 8 | 5:00 PM |
Mark M. |
that's a wrap for today's chat
|
Mark M. |
the next one is Saturday at 9am US Eastern
|
Mark M. |
have a pleasant day!
|
MyWay | has left the room |
Mark M. | turned off guest access |