Android Problem calling TextView from second layout file

后端 未结 4 583
情书的邮戳
情书的邮戳 2021-01-24 08:34

Hey guys the main layout xml file for my activity is R.layout.date_list_layout as it is used as follows

 public void onCreate(Bundle savedInstanceState) {
 super         


        
4条回答
  •  深忆病人
    2021-01-24 09:09

    As Second TextView is the part of another layout so we have to used

     setContentView(R.layout.R.layout.display_item);
    

    So for second TextView Change you code to

    setContentView(R.layout.display_item);
    
    TextView currency = (TextView) findViewById(R.layout.display_item/R.id.currency);
    
    currency.setText(cur);
    

提交回复
热议问题