Android Development Day1

Source: Internet
Author: User

Notes

Turning all. class files into a. dex file is the advantage of a DVM (Dalvik vm).

Soon, DVM. Register-based architecture

Android version 4.1.2 and 2.3 are the most stable
Any control on Android inherits from view

SYSTEM.OUT.PRINTLN () to output. Not even Ln.
Et_number.gettext (). ToString ()
Et_number.gettext () can actually

Mainactivity eventually inherits from the contextual context

Call

Relativelayout Linear layout

  <edittext android:id= "@+id/et_number" android:layout_width= "Match_parent" android:l        ayout_height= "Wrap_content" android:inputtype= "textpersonname" android:hint= "Please enter Number"/> <Button        Android:id= "@+id/btn_call" android:layout_width= "wrap_content" android:layout_height= "Wrap_content"         android:text= "Dial" android:layout_below= "@id/et_number"/> <button android:id= "@+id/button2"        Android:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:text= "button"          android:layout_torightof= "@id/btn_call"//At the same time not in the right, but not aligned android:layout_below= "@id/et_number"// android:onclick= "Dianle"/>  
public class Mainactivity extends appcompatactivity {EditText et_number;        @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);        Setcontentview (r.layout.relative);        Et_number = Findviewbyid (r.id.et_number);//System.out.print (number);        Button Btncall = Findviewbyid (R.id.btn_call);                Btncall.setonclicklistener (New View.onclicklistener () {@Override public void OnClick (View v) { if ("". Equals (Et_number.gettext (). toString ())) {Toast.maketext (Mainactivity.this, "number is empty", Toast .                    Length_short). Show ();;                Return                } System.out.println (Et_number.gettext (). toString ());                Intent Intent = new Intent ();                Intent.setaction (Intent.action_call);                Intent.setdata (Uri.parse ("Tel:" +et_number.gettext (). toString ()));       Open Intent startactivity (intent);     }        });    } public void Dianle (View v) {System.out.println ("hahah");; }}
Add permission to make a call:

==========================================================

1.1g-4g
g:generation 代 3g:第三代移动通信技术1g: 大哥大    特点:安全性差,容易受干扰,通话不稳定,不能发短信2g:小灵通等功能机    特点:通话质量稳定,可以发短信彩信,简单wap上网,支持一些简单的java游戏3g:android ios 等智能手机    特点:上网快了很多,能够处理图像,音乐,视频流等多种媒体形式.4g: lte , long time evolution    特点: 上网速度更快,100M带宽。 区别:网速不同,处理的内容不同
2.Android Operating System Introduction
 android系统是由安迪鲁宾团队开发的,最初用于数码相机,2005.08被google收购android名字是因为安迪鲁宾喜欢一个游戏的人物--大瓢虫android图标:上厕所的灵感android应用范围:手机,平板,智能家居,穿戴设备。
3.Android Evolutionary history
2.3 比较稳定的一个版本 ,NFC 近场通信技术3.0 专为平板设计 4.1.2   4.0后比较稳定的版本,4.*同时支持平板和手机5.0   新特性
4.Android system Architecture (emphasis)
分层的架构JNI java native interface 1.application :应用层 ; java2.application framework :应用框架层  , java+JNI3.libraries 和 dalvik : 函数库和虚拟机层,  c/c++ 4.linux kernel : linux 内核驱动层, c
5. Two different types of virtual machines (familiar)
版权问题:jvm : java虚拟机 sundvm:  dalvik虚拟机  google区别:    1.基于的架构不同,jvm 基于栈架构,栈是位于内存上的一个空间,执行指令操作,需要向cpu寻址; dvm 基于寄存器架构,寄存器是cpu的一个组成部分,执行指令操作无需寻址直接执行。    2.执行文件的格式不同,jvm执行的是多个.class文件。 dvm执行的是一个.dex文件
6.art mode Android Runtime
    空间换时间的概念。    art:程序在安装时需要预编译读取,将代码转换为机器码,好处:程序运行时,无需时时转换,运行速度快 ; 缺点:安装时间稍长,由于转换机器码,所以占用略高的存储空间。
7. Building the development environment
1.JDK 32 642.开发工具,eclipse , android studio3.android sdk , sdk: soft developer kit adt : android develper tool  bundle:集apilevel : 19     4.4版本           18     4.3           11     3.0           10     2.3            8     2.2aapt:android application package tooladb :  建立电脑与手机之间的链接dx.bat : 将多个.class 打包成一个.dexsdk下的目录: add-ons:预留的一个附加目录build-tools:构建工具目录docs: 文档目录extras:开发中额外提供的一些工具及jarplatforms: 不同版本android的核心jar包platforms-tools:平台一些相关的工具sources:源码system-images:系统镜像文件tools:开发中使用的一些工具,如9path,做图片拉伸适配的。
8.Android Sdkmanager Introduction 9. Introduction and creation of simulator
常用的屏幕分辨率:3.2  ----- QVGA ------320*4803.7 ----- WVGA ------480*8004.7 -----WXGA ------1280*720
10.DDMS Introduction
ddms: dalvik debug manitor services     devices: 列出当前电脑所连接的所有android设备,及android设备运行的进程,结束一个进程,设置程序为debug模式,截屏。logcat: 会打印系统运行过程中所有日志信息。file explorer: 列出当前设备所有目录。    /data/app:安装的第三方apk都在此目录     /system/app: 系统预装应用apk在此目录      /data/data:应用的私有目录,系统每安装一个新的应用程序,都会在此目录创建该应用包名的文件,用来存放该应用的私有数据,当应用卸载时,该包名的文件夹也会被删除。         /sdcard :外部存储目录,一般会链接指向到另一个目录,用来存放大数据。
11. Create a HelloWorld project
部署运行的三种方式:1.右击工程,run as2.工具栏的按钮3.快捷键:ctrl+F11
12.android Engineering Catalog Structure
img: ../img/a.jpgsrc: java 源码代码gen: 自动生成的文件目录,不需要修改; R类 ,是对资源文件的一个索引android核心jar包和第三方jar包assets:资产目录,用来存放程序运行过程中所需要的一些工具,数据库bin:编译打包过程中产生的目录libs:res:        drawable:图片资源        layout:布局资源        menu:菜单资源        values: demins 长度相关, string:字符串  style 样式androidManifest.xml:  清单文件, 包名,版本号,版本名称,最低运行版本,图标,应用名称,程序的入口activity, 还可以配置应用程序使用的权限信息。
The 13.Android packaging process
        jdk          dx.bat                                     aapt        签名jarsigner.java -----> .class ------>.dex(res,assets,androidmanifest.xml)------->.apk--------->final apk
14.ADB instruction Exercise (emphasis)
ADB :android debug bridge 建立手机与电脑直接的连接  adb运行的端口号是5037环境变量的配置:C:\kaifa\adt-bundle-windows-x86_64_20140101\sdk\platform-tools1.adb devices :列出当前电脑所连接的android设备2.adb push pc_path  phone_path :将电脑端文件放到手机端3.adb pull phone_paht pc_path :将手机端文件拉到电脑端4.adb install [-r] apkpath ; 安装一个电脑端的apk文件。-r:强制安装5.adb uninstall packagename; 卸载一个应用6.adb kill-server : 结束adb服务的链接7.adb start-server :开启adb服务的链接8.netstat -oan 查看端口: 查看端口  9.adb shell:进入当前设备linux环境下10.adb shell + ls -l :查看当前设备的目录结构11.adb shell+ logcat :查看系统运行中的日志信息注意: 如果当前电脑链接的是多台android设备,需要指定操作的是哪台设备,需要在adb后加 -s 设备序列号。
15. Telephone Dialer (emphasis)
1.产品经理: 需求分析文档,设计原型图2.UI工程师: 设计UI界面3.架构师: 写架构,接口文档4.码农: 服务端,客户端        1.写布局界面        2.写业务逻辑            1.通过布局文件中对控件配置的id,在activity中可以获取控件的对象,Edittext Button                findViewById(int id);            2.为按钮设置点击事件                bt_callphone.setOnclickListener( OnclickListener listener);                            3.在点击事件的onclick方法中,找到用户输入的电话号码            4.创建一个Intent对象                    Intent intent = new Intent();            5.为Intent对象设置一个打电话的动作                    intent.setAciton(Intent.ACTION_CALL);            6.位Intent对象设置一个数据                    intent.setData(Uri.parser("tel:"+number));            7.启动Intent对象                    startActivity(intent);            8.在androidmanifest.xml中设置一个打电话的权限                 <uses-permission android:name="android.permission.CALL_PHONE"/>5.测试工程师: 测试应用6.运营人员: 写软文,上传应用7.商务合作: 买量,买广告位,卖广告位
16. Four ways to write a button click event 17. Common layouts in Android (multi-practice) Table Div+css

Android Development Day1

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.