简体   繁体   English

为什么数据 API 不会调用

[英]why data API won't call

I tried to call the data to the detail page but the data doesn't want to be called, but the data has been called in the main activity section.我试图将数据调用到详细信息页面但数据不想被调用,但数据已在主活动部分中调用。 when I press to go to details page, only blank page appears.当我按到 go 到详细信息页面时,只出现空白页面。

this is the activity detail code这是活动详情代码

class DetailActivity : AppCompatActivity() {

private var item: MakeUpModel? = null


override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_detail)

    initview()

}

private fun initview() {
    item = intent?.getParcelableExtra("data")

    tv_detail_name.setText(item?.Name)
    tv_detail_price.setText(item?.Price)
    tv_detail_desc.setText(item?.Description)


    Glide.with(this)
        .load(item?.Picture)
        .apply(
            RequestOptions()
                .override(500,500)
                .placeholder(R.drawable.ic_launcher_background)
                .priority(Priority.HIGH))
                .into(iv_detail)

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
        tv_detail_desc.justificationMode = LineBreaker.JUSTIFICATION_MODE_INTER_WORD
    }
  }
}

Have you logged the data in mainActivity is it coming?您是否在 mainActivity 中记录了数据,它来了吗? also is your object parcelable?你的 object 也可以包裹吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM