我将数据从活动 A 传递到 MessageDetailActivity。OnCreate() 是设置文本的正确位置吗?
public class MessageDetailActivity extends Activity {
private TextView bodyTextView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupUI();
}
public void setupUI(){
Bundle bundle = getIntent().getExtras();
this.bodyTextView = (TextView) findViewById(R.id.bodyTextView);
Log.d("VALUE IS", bundle.getString("message"));
Toast.makeText(getApplicationContext(), bundle.getString("message"),Toast.LENGTH_SHORT).show();
bodyTextView.setText(bundle.getString("message"));
}
}