Office Hours — Today, April 15

Tuesday, April 13

Mark M.
has entered the room
Mark M.
turned on guest access
Apr 15
8:55 AM
LL
has entered the room
LL
has left the room
9:10 AM
Kumar V.
has entered the room
Mark M.
hello, Kumar!
how can I help you today?
Kumar V.
Hi Mark
Just wanted your thoughts on Hilt as di. As I am going to work on new project, thought to explore that, but wanted some expert view on that.
Mark M.
I have not used it much yet -- I hope to do so in the coming months
while I have heard good things about it, it is built on top of Dagger, which is a fairly complex DI solution
for smaller Kotlin projects, particularly those that might go in a Kotlin/Multiplatform direction, I still recommend Koin
Kumar V.
Yes, I still have problem sometimes in configuring dagger.
koin, is it, ok.
Mark M.
for larger projects, or projects with a fair bit of Java, Dagger/Hilt is probably the right direction
Kumar V.
Okay
9:15 AM
Kumar V.
View paste
I am unable to figure this out. I have scenario, I am getting the video data in background via viewModel, coroutine and result in LiveData. The call to viewModel happens in onViewCreated of fragment. And in onResume I initialise ExoPlayer.

Now if I get the livedata result before onResume has completed and call play() by passing the videoUrl it would fail as ExoPlayer is not initialised yet.

How do I sync up this ?
View paste
And this are the 2 known solutions. 
a) init ExoPlayer instance after receive data, b) invoke ViewModel after init ExoPlayer.
Mark M.
I agree that those two sound like the right solutions
Kumar V.
But is there any better known standard way for this ?
Mark M.
sorry, but I am not an ExoPlayer expert -- my experience with it is limited, and I cannot tell you when the correct time is to initialize it
Kumar V.
Okay.
Mark M.
all else being equal, initializing things in onResume() seems scary
but, for all I know, that is what ExoPlayer requires here
Kumar V.
View paste
But that's the recommended one by google itself in their sample app.
override fun onStart() {
        super.onStart()
        if (Util.SDK_INT > 23) {
            initializePlayer()
        }
    }

    override fun onResume() {
        super.onResume()
        if (Util.SDK_INT <= 23 || mPlayer == null) {
            initializePlayer()
        }
    }
9:20 AM
Mark M.
again, I am not an ExoPlayer expert, and it is possible that their sample app is not illustrating best practices
Kumar V.
View paste
Ha ha, may be.
That's it mark nothing else. 
And before leaving just wanted to check, is there any new books that is pipeline ?
Mark M.
in terms of updates, *Elements of Android Jetpack* and *Exploring Android* will get updated sometime after Android Studio 4.2 is shipped in a stable form -- it seems overdue for that
*Elements of Kotlin Coroutines* will get an update in a couple of weeks, and *Elements of Kotlin* should reach 1.0 on Monday
in terms of new titles... it's possible that there will be an *Elements of Jetpack Compose* coming out :-)
oh, and *Elements of Android S*
9:25 AM
Kumar V.
View paste
Okay, Elements of jetpack compose is something to look for, always had a trouble with online blogs.

On a side note, if I can ask you some suggestions of how do I improve android skills on daily basis, as I feel I am left out just doing my office works which is sometimes mundane
Mark M.
um, other than experimenting with personal/side projects (and reading books, of course), I am afraid that I do not have much in the way of recommendations on that
Kumar V.
Ya makes sense, that is the idea work on personal projects.
View paste
That's it mark. Thanks. 
Have a good day.
Mark M.
you too!
9:30 AM
Mark M.
that is a wrap for today's chat
the transcript will be posted on https://commonsware.com/office-hours/ in a bit
the next chat is Saturday in the 4pm US Eastern time slot
have a pleasant day!
Kumar V.
has left the room
Mark M.
turned off guest access

Tuesday, April 13

 

Office Hours

People in this transcript

  • Kumar Velu
  • LL
  • Mark Murphy