onCreate Override function not call?
You are not supposed to instantiate activities yourself like you are doing with DemoActivity()
.
Instead you should let the framework instantiate the activity and follow up with appropriate lifecycle function calls such as onCreate()
. To instruct the framework to launch an activity this way, use startActivity()
(or startActivityForResult()
) from a Context
.