0

I have a very simple Android Project in Kotlin. Just to dig in Kodein. I can not see the two TextViews in the main_layout?

I have used MVP pattern for the only MainActivity I have there..

The app starts without a crash and is show a blank white screen.

Any hints?

BaseActivity:

abstract class BaseActivity<V : BasePresenter.View> : AppCompatActivity(), BasePresenter.View  {

    protected abstract val layoutResourceId : Int
    protected abstract val presenter : BasePresenter<V>

    val kodeinMu = LazyKodein(appKodein)

    protected abstract fun initUI()
    protected abstract fun initPresenter()

    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)
        setContentView(layoutResourceId)

        initUI()
        initPresenter()
    }

    override fun onPause() {
        super.onPause()
        presenter.pause()
    }

    override fun onStop() {
        super.onStop()
        presenter.stop()
    }

    override fun onDestroy() {
        super.onDestroy()
        presenter.destroy()
    }

    protected fun toast(s: String) {
        System.out.println("TAG $s")
    }
}

I have read that it is because of API 28 you only can see on API_28 devices or emulators. Either emulator or on real device were also blanked out.

Tranquillo
  • 235
  • 2
  • 13
  • 1
    Can you share the code here? – Kartik Jan 30 '19 at 10:06
  • @Kartik see Link in original Post. There I have zipped the whole example Android Studio project – Tranquillo Jan 30 '19 at 10:07
  • 4
    @Tranquillo It is far better to share code samples directly on Stack Overflow. Think about the time someone who wants to help will lost finding your error if he has to download your whole project, understand the structure, naviguate through your code to find the problem... – Ctorres Jan 30 '19 at 10:14
  • @Ctorres I know. but I dont know what to share? – Tranquillo Jan 30 '19 at 10:15
  • You can copy/paste your code and format it with the tools in the text editors. Alternatively, you can format the code by adding four spaces before every code lines. You can also enclose a single line code with backquotes (`). – Ctorres Jan 30 '19 at 10:17
  • @Ctorres I know how to paste code. I wouldn't know which part of code I should share here? – Tranquillo Jan 30 '19 at 10:20
  • 1
    Oh sorry, I didn't read well your comment. I though you were asking how to format the code. You should share the code you suspect to doesn't work. You can share your XML containing the layouts for example, I don't know what's wrong, I can tell you exactly what to share... – Ctorres Jan 30 '19 at 10:20
  • You can share the main components of your application, then if everything seems fine, someone will probably ask you for another part of your code ;) – Ctorres Jan 30 '19 at 10:22
  • @Ctorres I have added the BaseActivity, where I have the layouts resource id. I set that with R.layout.main_layout in the MainActivity. – Tranquillo Jan 30 '19 at 10:22
  • But this is not your actual main activity, it is the parent class of your main activity... – m0skit0 Jan 30 '19 at 10:42

1 Answers1

3

You override the wrong onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) in you activity: use this : onCreate(savedInstanceState: Bundle?)

Maksim Novikov
  • 835
  • 6
  • 18