Android (Java) Learning Notes 162:android Development Basics

Source: Internet
Author: User

Adt

Android develop tools, Android development tools (Eclipse plugin) The latest version of 23.xxx is not good. Some new controls are enforced by default.

Sdk

Standard Develop kits Standards Development Kit

Directory structure of the SDK
    • Add-ons

Add-ons, put in an extra tool. Google API, provide Google Maps jar Package * Build-tools compilation tool, Google SDK upgrade after use of directory * Docs document directory. Development documentation. * Extras add-on tool Support folder, providing backwards compatible jar packages. and extra drive, camera drive, mobile phone drive * Platform Development platform * Platform Tools development tool * Sample Instance code * Source Source code * System-image System Image * Tools Directory development tool

AVD

Android Virtual devices simulator

Screen resolution

vga:480 * 640 qvga:240 * hvga:480 * 854 wvga:480 *

Directory Structure of Android project
    • Src

Source code * Gen Tool automatically generated code buildconfig debug switch default on R.java many static internal class * Android.jar development with JAR Package * Android dependence dependent, backwards compatible dependent jar Package * A Ssets Asset Catalog holds some other types of files * Bin Eclipse Tool compiled folder * Libs application development with JAR Package * RES Application resource * Androidmanifest.xml manifest file

Resolution Difference

L-lowm-middleh-high 72*72 x-xtra 144xx-super-Large 144

32:48:72:96:144 2:3:4.5:6:9

Process for Application Package installation
    1. Javac.exe compile. java files into a. class
    2. Turn the. dex File

\sdk\platform-tools\dx.bat 3. Package the file and application manifest file Manifest.xml in the Res directory to an APK 4. Upload apk to your phone and install and run

adb

Android Debug Bridge Android Debugging bridges (socket communication)

Common ADB directives
    • ADB install <xxx.apk>

Installing a apk-r overlay installation

    • ADB Uninstall < package name >

Uninstall an APK, the package name is the application's unique logo, a mobile phone can not have two application package name the same.

    • ADB shell

The Linux command line that comes directly to the mobile OS

    • ADB push

Push: Import a file on your computer to the path of the file phone on your phone's adb push computer

    • ADB pull

Pull: Import the file from your phone into the path on the file on your computer's ADB pull phone

Ddms

ADT Plug-in functionality, provides a debug view Dalvik Debug Manager System

Four ways to click events
  1. Inner class implementation interface new implementation class
  2. Private class MyListener implements Onclicklistener
  3. {
  4. @Override
  5. public void OnClick (View v) {
  6. button-clicked Event
  7. SYSTEM.OUT.PRINTLN ("Call 110");
  8. Loosely coupled//machine code-->C language-->c++--->java (c+++)--->c#--> natural language//intention. Intent//tea-making and hitting soy sauce
  9. Intent Intent = new Intent ();
  10. Set actions to make calls
  11. Intent.setaction (Intent.action_call);
  12. Set data URI Uniform Resource Identifier URL Uniform Resource Locator network path HTTP FTP rstp//ITHEIMA://56
  13. Intent.setdata (Uri.parse ("tel://110")); Activating action startactivity (intent);
  14. }
  15. }
  16. Anonymous inner class View.setonclicklistener (new Onclicklistener () {

  17. @Override

  18. public void OnClick (View v) {//click event

        }});简单点击事件的实现 一般都用匿名内部类
  19. Let the current activity implement interface extends activity implements Onclicklistener if the buttons are very numerous, it is recommended to use this method

  20. Configure the Click event method in the layout file class to write the demo

Steps for Android App development
    1. Layout Write UI Layouts
    2. SRC Write the Java code
      1. Find the controls you care about
      2. Write click events to get Data
    3. Compile Run View results
Common UI Layouts
    • Linear layout LinearLayout

Important attribute android:orientation= "horizontal" horizontal arrangement android:orientation= "vertical" vertical arrangement android:layoutwidth= "0dip" Android:layoutweight= "1" weight

    • Relative Layout relativelayout

    • Absolute layout absolutelayout

Outdated set-top boxes

    • Table Layout Tablelayout

    • Frame Layout Framelayout

Android (Java) Learning Notes 162:android Development Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.