android 学习方法:

1.了解什么是android

2.建立开发环境

3.阅读sdk文档

怎么阅读,方法,步骤?

http://linuxdevices.com/articles/AT9900056470.html  学习android 路径

http://www.chinaup.org/docs/documentation.html  android sdk中文文档

看自带的例子

A developer's perspective on Google's Android

by John Lombardo

Spread the word:
digg this story
 

On Monday, November 12, 2007, Google released Android, a complete Linux based software stack aimed directly at the cell phone marketplace. I'll let others talk about what it means for other players in the marketplace, the intricacies of GPL2 vs the Apache License, etc. This article dives straight into the heart of the SDK and API itself, summarizing some of the documentation provided by Google, then jumping into building an application using Android.


Android Emulator
(Click to enlarge)

So, what Is Android?

Android is a complete software stack for mobile devices such as cell phones, PDAs and high end MP3 players. The software stack is split into  four layers:

  • The application layer
  • The application framework
  • The libraries and runtime
  • The kernel

Cell phone users obviously work with applications in the application layer. Android developers write those applications using the application framework. Unlike many embedded operating environments, Android applications are all equal -- that is, the applications that come with the phone are no different than those that any developer writes. In fact, using the  IntentFilter API, any application can handle any event that the user or system can generate. This sounds a bit scary at first, but Android has a well thought-out  security model based on Unix file system permissions that assure applications have only those abilities that cell phone owner gave them at install time. The framework is supported by numerous open source libraries such as openssl, sqlite and libc. It is also supported by the Android core libraries -- more on that in a second. At the bottom of the stack sits the Linux 2.6 kernel, providing the low level hardware interfaces that we all expect from a kernel. This is a Unix based system -- that is, the Unix C APIs are available -- but don't expect to drop to a shell and start executing shell scripts with your old friends grep and awk. Most of the Unix utilities are simply not there. Instead Android supplies a well thought out API for writing applications -- in Java using the Android core libraries.

That's right, Android applications are almost exclusively written in Java. The Android core library is a big .jar file that is supported by the  Dalvik Virtual Machine -- a fast and efficient JVM work-alike that enables java-coded applications to work on the Android cell phone. This is similar to, but not the same as using Sun's JVM directly.

Building your development environment

Google provides three versions of the SDK; one for Windows, one for Mac OSX (intel) and one for Linux (x86). They also provide two development environments -- one is Eclipse based, and the other is a "roll your own." The Eclipse based environment is quite feature-rich and should suffice for most developers. There is no reason that you can't use both Eclipse and "roll your own."

If you get stuck in eclipse (like I did), you may find yourself dropping to the command-line interfaces to see what's really going on. However for this article, I'll assume that you're using the Eclipse IDE for your Android software development needs. Once you've downloaded the Android  SDKEclipse and the  Eclipse Plugin, you should work through the first few sections of Google's  install document ( System and Software RequirementsInstalling the SDKInstalling the Eclipse Plugin). I'd leave the rest of the document for  later as it does get quite detailed quickly.

Read the Friendly Manual

Google has done a good job of writing a lot of documentation for Android. However, there isn't a great way of knowing what's important to read now vs. what can wait. Here are some links to documents that are important to understand what Android is and how to develop applications using it. If you read them in the order listed, then you'll gain understanding more quickly as you read increasingly detailed documents. Note that a lot of the documentation is available both  online and in the SDK_ROOT/docs/index.html directory on your machine. If you have a fast enough connection, I would suggest using the on-line versions since they will be more up to date.

Here's the order in which I suggest you read the documentation:

  • What is Android? Explains what Android is and gives a high-level overview of its features and architecture. Don't dive into the links just yet -- just get a feel for this overall document.
  • Read the Anatomy of an Android Application page. This details the four building blocks of an Android app: Activity, Intent Receiver, Service and Content Provider. Again, don't follow the links just yet -- just get an overview of the architecture. You may want to reread sections on Activities and Intent Receivers -- gaining an understanding of these concepts is critical to understanding how to build an Android application. If you don't get it yet, you'll see it again when you go through the Notepad Application Tutorial.
  • Next read the Development Tools document. Again -- just get a flavor, don't dive into the detail yet.
  • Read the Lifecycle of an Android Application page.
  • Now, finally, it's time to get your hands dirty. Work through the Hello Android page. Make sure you actually do it using Eclipse.
Note: I had a problem here. The first time I ran the application, it worked fine. However on subsequent runs my application would not appear on the emulator. I killed and restarted the emulator, killed and restarted eclipse several times -- no joy. Finally, somewhat frustrated, I was going to re-install everything. However before I did, I found an invisible instance of the  Android Debug Bridge (adb) running. I killed it and everything worked again. I thought I had to close the emulator after each run of an application, but this turns out not to be the case. When I closed the emulator after my first run, it left the instance of adb running, which interfered with the subsequent instances.
  • Now go back and read the rest of the Installing the SDK document -- the bottom half of it details some great debugging tips and features.
  • Next, go through the Notepad Application Tutorial. This is where the rubber really meets the road. If you spend the time to go through this series of exercises and really understand the code, you will be well on your way to becoming an Android expert.
  • Read the Developing Android Applications pages. This will take some time -- these articles go into a lot of detail about several topics including how to implement the UI, data storage/retrieval and the security model.
  • Finally, go back through this list and follow the links in the previous documents as topics interest you.

There's a lot of documentation, but if flows together nicely, reflecting the architecture of the environment.

Dissecting the SDK

Whenever I download an SDK, I like to take a look at the files I've installed. Often, there is a wealth of information hidden in the SDK itself that is not readily visible from the documentation. So here's what you'll find in the Android SDK on a Windows machine:

  • android.jar - The Android application framework. Unzipping this jar reveals the entire class structure and all of the supporting classes of the framework. Currently there is no source.
  • docs - 100 megabytes worth of documentation, samples, etc.
  • samples - Six different sample applications - ApiDemos, HelloActivity, LunarLander, NotePad, SkeletonApp and Snake
  • tools - the various SDK binaries such as aapt, acp, and emulator live here.
    • lib - various templates and supporting jar files live in this directory

      • activityCreator - the activityCreator python application lives here.
      • images - The Linux file system images are found in this directory: ramdis.img, system.img and userdata.img. They are YAFFS2 file system images, so I couldn't open them without additional kernel support on my Fedora system.
        • skins - supporting emulator graphics for HVGA and QVGA screens in both landscape and portrait format.

Exercising the SDK

Now that you have read the documentation and set up and debugged a simple project, it's time to look at some real code. Since Google has provided us with several sample applications, the best place to begin is by examining them.

  1. If you have not already done so, execute the first few sections of Google's install document. Stop after you've installed the Eclipse plugin successfully.
  2. Now work through the Hello Android page if you haven't already. This will get you started working with Android applications and the debugger. Note that it's probably a good idea to create a new workspace for your Android projects if you already use Eclipse.
  3. Next we're going to set up Eclipse projects for each of the sample applications. You can never have too much sample code. I'll walk through setting up the Lunar Lander example and leave it as an exercise to the reader to set up the rest.
    1. Bring up the same Eclipse workspace that you used for the Hello Android, and close the project (Right click on the project in package explorer->Close Project).
    2. File->New->Android Project
    3. Project Name: LunarLander
    4. Click the "Create Project from existing source" radio button
    5. Browse to the samples/LunarLander directory in the SDK. If you find the right directory, the Properties fields will auto-fill with the correct information from the Package.
    6. Click Finish
    7. Bring up Eclipse's Console window (Window->Show View->Console) if it's not already visible in a tab at the bottom of the screen. It will show you the build process that Eclipse went through to create the application.
    8. Create a Run Configuration: Run->Open Run Dialog
    9. Highlight "Android Application" in the treeview to the left.
    10. Click the "New button".
    11. Name: Lunar Lander
    12. Click the Browse button next to Project
    13. Double-click the LunarLander project and hit OK
    14. Click the down arrow for the Activity and choose the one and only Activity: com.google.android.lunarlander.LunarLander
    15. Click Apply
    16. Click Run
    17. Switch to the Emulator and play a few rounds of Lunar Lander. Kinda fun.

Repeat for the other applications in the samples directory. This exercise should only take a few minutes -- besides, the Snake game is fun too! If you've taken the time to go through the  Notepad Application Tutorial, then you'll be familiar with the NotePad sample -- however, the NotePad sample is fully developed and has features beyond the NotePad developed during the Tutorial.

A File System Explorer Application

Finally, we'll use our new understanding of the Android to develop a simple file system explorer. The version in this article is pretty simple, but it can serve as a jumping-off point for a more serious application down the road.

Design

Before we start writing code, let's think about what a reasonable file system browser should do. It should

  • Phase I features

    • Show a list of files and directories
    • Allow the user to navigate through the directory structure by clicking on directories
    • Warn the user that he has clicked on a file
  • Phase II features
    • Allow the user to display a dump of a file when it is clicked
    • Use a tree view instead of a simple list
    • Show a dialog box with the filesystem information (size, permissions, etc) when the user clicks on an icon next to each file
    • Give this application permissions to read any file on the file system
  • Phase III features
    • Do all of phase II with pretty graphics, such as thumbnails, instead of boring dropdowns and list boxes
    • Execute applications that we understand, such as mp3 files

Process

This article will only cover Phase I of the project -- but when we're done, we'll have a functional file system explorer in just a few dozen lines of code.

To proceed with this hands-on example, click here.


New Android Project
(Click to enlarge)
It works!

If you clicked above to follow the hands-on example, you found that in about twenty lines of Java, and a small amount of XML, you've created a useful little application that will allow you to explore the Android's file system. For example, I found the ringtones in /system/media/audio/ringtones, as shown below.


Oooh, ringtones
(Click to enlarge)

As I mentioned in the design section, a lot can be done with this application, and we've hardly touched the surface of what you can do with the Android application environment. There's three billion cell phones out there. I suspect Google will get their fair share of them, so start cranking out code!

Conclusion

Android is a well-engineered development environment. Writing an Eclipse plug-in was a smart move by Google -- one that should be emulated by other SDK developers. Eclipse gives a developer and environment where he can really think about the business problem without worrying about the boring details. Adding the functionality of the plugin helps developers just sit down and start coding -- without having to worry about all the ins and outs of configuration files and the like.

Dislikes

Android is brand new to the general developer's world. As I write this, it's Wednesday, and the SDK came out on Monday of this week. Since it's brand new, there are some little problems that will have to be solved in the coming releases.

  • Many more examples for the APIs.
  • A more thorough explanation of what does and does not work under the emulator. My first example application was a simple MP3 player.
  • Release the source code. This will make it a lot easier to debug Android applications, as well as write them in the style that the Google developers wrote them.

Likes

Theres a lot to like about Android:

  • It's by Google -- so it has a company with some clout behind it.
  • Application Developers write their code in Java. Since the learning curve for Java is much less than that of C/C++/ObjectiveC, there will be many many developers who are eager to start writing applications for Android.
  • The SDK and API are well designed. There is some complexity there, and as I mentioned, the Documentation needs improvement (Google: call me :) -- but a well designed system is easier to understand and learn, even without lots of great examples.

Android 学习方法相关推荐

  1. Android学习方法和计划制定

    Android学习方法和知识体系 学习方法 计划制定 学习方法 学习方法的重要 这个是毋庸置疑的,好的学习方式可以做到事半功倍,同样不好的学习方法那就是 事倍功半了那到底什么样的学习方法才是好的学习方 ...

  2. 接手一手机android app维护 如何快速进入,快速上手Android开发,学会这三点就够了!...

    编程语言是个随互联网时代发展逐步更新的产物,面对互联网更新换代的速度,程序员们如何根据时代的变化选择不同的编程工具,选取适应互联网发展的方向才能与时俱进. 初识Android: 10年的时候,我无意之 ...

  3. 【近3万字分享】《Android开发之路——10年老开发精心整理分享》

    目录 前言 1 Android开发学习路线 1.1 大神最新总结(推荐直接看这个) 2021 最新Android知识体系 1.2按内容划分 1.3按阶段划分 1.4Android进阶路线(思维导图) ...

  4. Android开发笔记(一)

    开发手机联盟  -- Open Handset Alliance 什么是开放手机联盟? 开放手机联盟, Open Handset Alliance :是美国 Google 公司与 2007 年 11 ...

  5. android opencv kcf,目标跟踪的深度学习方法 与 opencv 实现 kcf 方法

    目标跟踪的深度学习方法 与 opencv 实现 kcf 方法 算法选型 10 2.1. 现有算法分类 10 2.2. 图像目标跟踪方法 11 1. 概述 1.1. 背景 行为识别的前提是需要对人体目标 ...

  6. android 点击事件消费,Android View事件分发和消费源码简单理解

    Android View事件分发和消费源码简单理解 前言: 开发过程中觉得View事件这块是特别烧脑的,看了好久,才自认为看明白.中间上网查了下singwhatiwanna粉丝的读书笔记,有种茅塞顿开 ...

  7. 如何学习android高级编程

    学了android高级编程有前途吗?进入2010年之后,android的应用开发进入了一个爆炸式增长的状态,从去年的不到1万款应用程序增加到现在的9万,而且即将突破10万,这也从开发者这一方面展现了用 ...

  8. 一篇文章一张思维导图看懂Android学习最佳路线

    一篇文章一张思维导图看懂Android学习最佳路线 先上一张android开发知识点学习路线图思维导图 Android学习路线从4个阶段来对Android的学习过程做一个全面的分析:Android初级 ...

  9. 我的Android学习体系

    我的Android学习之路历经坎坷啊,现在回过头来主要想分享下我学习Android开发所走过的过程中所学会的一些误区和弯路,那些让自己的进步一直很慢的原因,一直没有什么成就的原因,希望其他人可以借鉴我 ...

最新文章

  1. (二)、MariaDB、Apache软件安装
  2. 使用 Cufon 渲染网页字体
  3. 「仅凭照片就能判断一个人是否犯罪」?这样的研究能发表,LeCun、MIT谷歌等机构的1700名研究者怒了...
  4. 轻松监听Azure service health 状态
  5. oracle中如何创建一个过程,如何开发ORACLE存储过程
  6. 容器大小_C++ 顺序容器基础知识总结
  7. springcloud(五):熔断监控Hystrix Dashboard和Turbine
  8. 重新认识:指向函数的指针
  9. 用U盘制作Windows7安装以及MacBook Air上装Win7
  10. Manjaro 常用软件安装
  11. 少量代码完成火山图绘制
  12. Scala折叠(fold)
  13. r5 5500u和r5 4600u区别有多大 r55500u和r54600u哪个好
  14. 小尺寸2.4G SMD贴片天线方案 CA-C03 CrossAir贴片天线
  15. 5G时代来临,电影行业面临的机遇与挑战
  16. rest接口访问webService soap接口 用XStream javabean和xml的互转
  17. 使用python计算圆周率(有进度条)
  18. 自己整理的财务知识(财务比率)(英文不标准是为了自己建立自定义字段而已)
  19. 技术将加强首席执行官和首席财务官之间的关系
  20. 涉密信息系统集成资质条件

热门文章

  1. 需要了解的Smbios知识
  2. 2018年的智能手机
  3. Android 与 H5 交互基础普及
  4. PAT A 1007. Maximum Subsequence Sum (25)
  5. 实验吧-隐写术-黑与白
  6. 华为路由与交换 MPLS 协议原理与配置
  7. Barycentric Coordinates of Tetrahedron (计算四面体的重心坐标)
  8. 学习笔记(23):第一章: 路由与模板-Web前端技术与框架 4
  9. Revit中如何为曲面墙体开洞口,一键开洞?
  10. 野三坡传统民俗小板凳