Hello World for android

成功的第一篇文章,送给了Hello World for android。MainActivity.java主文件什么也没写,系统自动生成了如下代码

package org.cj.thefirstapp;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}

  那与“Hello world”与那里相关联呢?注意到strings.XML的内容,真相找到(我还在后面加了日期,以示学习起始日)

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">HelloWorld</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world 2021-05-05 16:21</string>

</resources>

  第一个博文先写到此吧

posted @ 2021-06-03 19:38  EL  阅读(52)  评论(0)    收藏  举报