Getting Started with Android

Unzip the sdk.zip file (the directory must not contain Chinese)

configure path

Create the first android project: helloAndroid

1. Make the sdk version 18

2 To accessorize the lower version, modify the manifest file: minSdk="8"

3 Four file directory structure

src: Java source code package written

gen: automatically generated Java source code package

assets: resource directory

bin: The directory containing the compiled generated files (such as Apk)

libs: since the jar package directory

res: resource folder

drawable-hdpl: image resource

layout: layout resources

values: some always-on resources (dimensions, strings, styles)

AndroidManifest.xml: App feature manifest configuration file

--src (source text folder)
    MainActivity.java: main interface class
-- gen (automatically generated source text folder)
    R.java: corresponding to res folder
         drawble: image
         layout: layout
       string: string
--res (resource file folder)
    drawable-xxx : image folder
        in order to adapt to different resolutions of mobile phones
    layout : the interface layout file
        function is similar to HTML
    values ​​: constant folder
        strings.xml : contains fixed strings, referenced in the layout: @string/ name
--AndroidManifest.xml (function manifest file)


The file directory structure of the Android system
"/" represents the root directory of the system
"/data/app/"
stores the third-party apk file
"/system/app/"
which is the system The application installation file
"/data/data/packagename/"
in the file corresponds to the application, which is automatically generated when the application is installed, and
"/storage/sdcard/" is automatically deleted when the application is uninstalled.
The folder
of the SD card 4. SDK file directory structure
"/docs" document directory index.html
/platforms   
contains the jar packages required for this version to run
/platform-tools
contains some development tools, such as adb.exe, sqlite.exe
/samples
contains some sample projects provided by Google, such as APIDemos
/source
contains part of the source code of the system
/tools
contains some development tools, such as draw9patch.bat, hierarchyviewer.bat


4. Three application development tools
   1. ADB: debugging tool
   adb shell
   adb install -r apkPath
   ls
  cd
  cls
  ctrl+c
 2 .DDMS: Debugging tools in eclipse:
          
Logcat: View log output:
File Explorer: View internal system files Devices: Display associated Android devices
Emulator Control: Operate control associated Android devices


Log provides multiple levels of print output methods, The colors displayed in the LogCat window are different . The
TAG must be specified when the Log is printed. In the LogCat, you can add TAG filtering to view the
LogCat. You can filter in two ways:
TAG name: display all the output of this tag name
– application package name: display all the output of the specified package name application If the font size uses SP as the unit, the setting has an effect. If the font size uses dp as the unit, the setting has no effect. In the layout Use match_parent/wrap_content for the width and height of the file view. If you must specify a specific value, use dp/dip as the unit text size and use SP as the unit . 6. Related API Activity: One of the four major application components   onCreate(): The method that is automatically called in Among them, load layout display setContentView(int layoutld); load layout ViewfindViewByld(in id): find the corresponding view object according to id R: application resource class R.drawable: inner class that contains all image resource identifiers R.layout contains all layout resources Identified inner class R.id: Inner class that contains all view id identifiers R.string: Inner class that contains all string labels View/Button: View/button setonClickListerlite Set point for the view to monitor View.OnClickListener Internal interface voidonClick(ViewV) The callback method of the click event Toast is the class used to display the short-term prompt text
























  staticToastmakeText( create a toast object show(): show small tips

Guess you like

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