Open IdioticMadman opened 2 weeks ago
// MainActivity findViewById<View>(R.id.tv_hello).setOnClickListener { TheRouter.build("second") // .withString("name", "zhangsan") .navigation(this) } @Route(path = "second") class SecondActivity : AppCompatActivity() { @Autowired(required = true) var name: String = "" override fun onCreate(savedInstanceState: Bundle?) { TheRouter.inject(this) super.onCreate(savedInstanceState) enableEdgeToEdge() setContentView(R.layout.activity_second) ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) insets } findViewById<TextView>(R.id.tv_result).text = name } }
预期应该是会 crash,但是一切正常显示空字符串