December 2017
Intermediate to advanced
260 pages
7h 34m
English
The let() function simply executes the function or given block with its own reference this as a receiver and returns the result. In Android, you can use it to execute all that code where you put a null check and then try to get and set value over it. We have shown you the use case in UserTimeLineFrgment.kt, where the code is as follows:
TwitterCore.getInstance().sessionManager.activeSession?.let { val userTimeline = UserTimeline.Builder() .screenName(TwitterCore.getInstance() .sessionManager.activeSession.userName) .build() val adapter = TweetTimelineRecyclerViewAdapter.Builder(context) .setTimeline(userTimeline) .setViewStyle(R.style.tw__TweetLightWithActionsStyle) .build() rvTimeline.layoutManager = LinearLayoutManager( ...
Read now
Unlock full access