0

I'm try to develop an android app in Kotlin. I'm using an MVP design pattern. Unfortunately, the application crashes due to an error in the presenter. Below the screenshot of the logcat and you can check my code at Github.

Could anyone please help me?

Thank you.

LogCat

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96

1 Answers1

1

you are declaring:

private lateinit var swipeRefresh: SwipeRefreshLayout 

then re-declare the same variable in onActivtyCreated:

val swipeRefresh = rootView.findViewById<SwipeRefreshLayout>(R.id.swipe_refresh)

try to delete val to use the class variable swipeRefresh.

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Ali bana
  • 161
  • 1
  • 14
  • I've already update my GitHub. Please check it. It's still doesn't work – Arief Purnama Muharram Oct 06 '18 at 11:40
  • i will try it, hope can found something. – Ali bana Oct 08 '18 at 02:40
  • I found the problem. the problem is your `data.lastMatch` is null, but your not make that variable to get `null`. so that's error will say not-null is null. so I change some your list become: `var lastMatch: List = ArrayList()` I look you create `gson` and `apiRequest` in fragment, I am recommended to move all that to presenter because your use MVP. – Ali bana Oct 08 '18 at 03:36