我想访问一个名为user_status的文本视图,该视图位于自定义xml布局文件中,以便用一些数据填充它。我想从我的主要活动java类访问它。我该怎么做呢?我已经在堆栈溢出中尝试了一些答案,但它要么无法正常工作,要么已过时。
LayoutInflater inflater = MessageActivity.this.getLayoutInflater();
View inflatedView = inflater.inflate(R.layout.message_row, null);
TextView userMessage= (TextView) inflatedView.findViewById(R.id.user_status);
userMessage.setText("NEW MESSAGE DUMMMY!");