【发布时间】:2011-04-26 00:06:40
【问题描述】:
我正在将数据从活动 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"));
}
}
【问题讨论】:
标签: java android android-activity textview oncreate