Develop the first android project (2018.4.27)


————————————————————————————————————————————————————

main interface class

/**

 * Main interface Activity class

 * Main interface: Click the application icon to start the interface

 * Activity inherited from one of the four major components

 * @author 三星
 *
 */
public class MainActivity extends Activity {

/**

* Overridden method

* onCreate: Called automatically when the current class (Activity) object is created

* Callback method: automatically called by the system

*/

@Override

protected void onCreate(Bundle savedInstanceState) {

//Call the parent class to do some default initialization work

super.onCreate (savedInstanceState);

//load layout file

//Specify the variable corresponding to the layout file in R, load the layout file and finally display it in the window

setContentView(R.layout.activity_main);
}

}

——————————————————————————————————————————————

Requirements for the version of the mobile phone

   minSdkVersion: the minimum version, if the version of the phone is smaller than this value, the app cannot be installed

       targetSdkVersion : the best version, the version of the phone can be larger than this value  

————————————————————————————————————————————————————

<string name="app_name">微信</string>

    <string name="hello_world">Hello world!</string>

    <string name="XiangYang">New Year's forgiveness green green green green ~</string>

This code makes the interface look like this:

                    

——————————————————————————————————————————————



——————————————————————————————————

Android system file directory structure

/                                       

Represents the root directory of the system

/data/app/

Stores third-party apk files

/system/app/

where is the application installation file in the system

/ data/data/ packagename /

The file corresponding to the application is automatically generated when the application is installed, and automatically deleted when the application is uninstalled  

/storage/ sdcard /

sd card folder


SDK file directory structure

/docs  

Documentation directory   index.html

/platforms

包含各个版本运行所需要的 jar

/platform-tools

包含一些开发工具 , adb.exe, sqlite3.exe   

/samples

包含一些 google 提供的样例项目工程 , : APIDemos

/source

包含系统的部分源码

/tools

包含一些开发工具 , :draw9patch.bat, hierarchyviewer.bat

————————————————————————————————————————————————————

adb 命令及其作用:

* adb start-server:启动adb进程

* adb kill-server:杀死adb进程

* adb devices:查看当前与开发环境连接的设备,此命令也可以启动adb进程

* adb install XXX.apk:往模拟器安装apk

* adb uninstall 包名:删除模拟器中的应用

* adb shell:进入linux命令行


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325796027&siteId=291194637