我刚开始尝试 Android 应用程序开发,所以我决定尝试一下 Android 自己的教程(这个:http: //developer.android.com/training/basics/firstapp/starting-activity.html)
我的新活动中的文本视图不会显示。这是我的代码:
public class DisplayMessageActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/* Get the intent and the message sent with it */
Intent intent = getIntent();
String message = intent.getStringExtra(GoogleTutActivity.EXTRA_MESSAGE);
/* Create a new textview where we can show the message the user sent */
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
setContentView(R.layout.activity_display_message);
}
}