how to get id in different layout

后端 未结 5 1972
無奈伤痛
無奈伤痛 2020-12-30 14:52

i have id \"@+id/call\" in single_item.xml when i use findVewById it (the layout setcontextview(R.layout.main)) .the ap

5条回答
  •  余生分开走
    2020-12-30 15:29

    You are trying to find a View (R.id.call) that is declared in R.layout.single_item in the layour R.layout.main, so I guess it is throwing a Null Pointer Exception.

    You should either declare your "@+id/call" element in your main.xml file, or set the context view to R.layout.single_item

提交回复
热议问题