Android Beginner Tutorial Theory Knowledge (First chapter QuickStart)

Source: Internet
Author: User
Tags gettext

First, comprehensive introduction.

Directory structure of the Android project activity: The interface that is displayed when the app is opened SRC: Project code R.java: Resource for all resource files in Project IdAndroid.jar:Android jar package, import this package to use Android Apilibs: Import third Party jar package Assets: storage resource files, such as MP3, video file bin: Store the compiled and packaged files, APK can be installed directly on the phone. Res: Storing resource files, all resource files stored in this folder will generate resources iddrawable: Store picture Resource layout: Store layout file, assign layout file to activity by resource ID The layout of the layout file is displayed in the interface menu: Defines the style of the menu Strings.xml: holds the string resource, each resource will have a resource idandroid (manifest file) specifies the package name of the app package= " Com.itheima.helloworld "Data/data/com.itheima.helloworld (the package name specified in the code above) Application-generated files are stored in this path. Android's four components are fully configured in the manifest file before using the configuration that takes effect on the entire application Ddmsdalvik Debug Monitor Servicedalvik Debug Monitoring Service common ADB instructions Android Debug Bridge: Android Debug bridge adb start-server: start adb process adb kill-server: kill adb process ADB Devices: To view the devices currently connected to the development environment, this command can also start the ADB process adb install xxx.apk: Install apkadb Uninstall package name to the emulator: delete the application in the emulator adb shell: Go to linux command line PS: View the running process ls: View the file structure under the current directory Netstat-ano: View the process of occupying port Phone Dialer feature: User input a number, click the Dial button, start the system calls the application to call the number 1. The definition layout component must be set to a wide height, otherwise it cannot be compiled android:layout_width= "wrap_content" android:layout_height= "Wrap_content" <!--Match_ Parent identity matches Parents--if you want to manipulate a component in Java code, the component needs to set the ID so that it can get the component through the ID in the code androiD:id= "@+id/et_phone" 2. To set the button to listen to the button set to listen//through the ID to get the button object buttons Bt_call = (Button) Findviewbyid (r.id.bt_call);//button settings Click Bt_ Call.setonclicklistener (New MyListener ()); 3.        Get user input number//get user input number, first get input box component EditText Et_phone = (EditText) Findviewbyid (R.id.et_phone); String phone = Et_phone.gettext (). toString (); 4.    Get the number out. Android system based on the action mechanism to invoke the application of the system, you tell the system what you want to do, the system will be able to do this action of the application to you, if there is no such application, will throw abnormal set action, through the intention to inform the system//the number of the call//first create an Intent object    Intent Intent = new Intent ();    Set the action, call Intent.setaction (Intent.action_call);    Intent.setdata (Uri.parse ("Tel:" + phone)); Tell the system the intention, start the activity startactivity (intent); Add permissions <uses-permission android:name= "Android.permission.CALL_PHONE"/> Click on four ways to define an event the first defines a mylistener implementation of the Onclicklistener interface Button bt1 = (button) Findviewbyid (R.ID.BT1); Bt1.setonclicklistener ( New MyListener ()); the second defines an anonymous inner class implementation of the Onclicklistener interface Button BT2 = (button) Findviewbyid (R.ID.BT2); Bt2.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {SYSTEM.OUT.PRIntln ("second type"); }); The third allows the current activity to implement the Onclicklistener interface Button BT3 = (button) Findviewbyid (R.ID.BT3); Bt3.setonclicklistener (this); The fourth kind (personal preferred) sets the OnClick property to the button node, android:onclick= "Click" and then defines the method with the same name as the property value in the activity. This method must have a view parameter of public void click (View v) {System.out.println ("Fourth");} SMS transmitter function: User input number and text message content, click the Send button, call SMS API to send SMS to the specified number 1. To define the layout input box prompt android:hint= "Please enter Number" 2. Complete the Click event First set the OnClick property of the button component onclick= "Send" defines this method in activity public void Send (View v) {}3.    Gets the number and content entered by the user EditText Et_phone = (EditText) Findviewbyid (R.id.et_phone);    EditText et_content = (EditText) Findviewbyid (r.id.et_content);    String phone = Et_phone.gettext (). toString (); String content = Et_content.gettext (). toString (); 4.    Call API to send SMS//Call API to send SMS Smsmanager SM = Smsmanager.getdefault (); Send SMS Sm.sendtextmessage (phone, NULL, content, NULL, NULL); add permission <uses-permission android:name= "Android.permission . Send_sms "/> If the text message is too long, you need to split it. After splitting, it is stored as a collection. list<string> SMSS = sm.dividemessage (content);

Second, the core summary.

<span style= "FONT-SIZE:12PX;" > Android project directory structure src: Project Java code genbuildconfig: app can debugr: Save Idandroid.jar of resources used in Project: Import this package, app can use Android Apilibs: Store third party jar package Asse TS: Resource folder, storage of video or music, such as large resource file Bin: Storage application Package compiled file Res: Resource folder, all resources in this folder, there will be resource ID, read through the resource ID can read the resource ID does not appear in the Chinese layout: Layouts folder, Save the layout file, all layout files in Android are XML files menu: Menus configuration folder, save menu configuration file, decide menu style Valuesstrings: string resource file, used to define string resource dimens: Length resource file, Used to define the length of resources style: style and theme resource file manifest file package: application's unique identification in the system Versioncode: The app's version number has the following child node activity is the entry activity <intent-filter > <action android:name= "Android.intent.action.MAIN"/> <category android:name= "android.i Ntent.category.LAUNCHER "/> </intent-filter> installation path third-party app save path: Data/app System App save path: system/appdata/data/ Package Name folder: The system provides an exclusive space for each application Ddmsdalvik Debug Monitor serviceadbandroid Debug Bridge for Android. * Establish connection between Eclipse and Android device adb directive adb start-server: start adb process adb kill-server: kill adb process adb install E:\yyh.apkadb Uninstall (App package name). The app package name is a unique identity for an item ADB devices: Lists the list of Android devices that are connected to the development environment adb Shell: Go to android command line AndroInstruction for ID: ls: Lists all the files and folders in the current directory, the same as the file Explorer in the IDE. PS: List all the processes that are running on the current system Netstat-ano: Check the port occupancy of the system </span>


Android Beginner Tutorial Theory Knowledge (First chapter QuickStart)

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.