文件名称:
Android编程手册:启动您的Android项目Android Programming Cookbook: Kick-start your Android Projects
开发工具:
文件大小: 8mb
下载次数: 0
上传时间: 2019-10-31
详细说明:本书提供了Android编程示例的汇编,可帮助您启动自己的Web项目。 它涵盖了广泛的主题,从服务和视图到Google地图和蓝牙功能。 借助简单明了的教程,您将能够在最短的时间内启动并运行自己的项目。Android Programming cookbook
i
Contents
1 Android Tutorial For Beginners
1.I What is android?
1.2 Installing Android studio
1. 3 Android versions and Android sdk manager
1. 4 Supporting different screen sizes
1.5 Android Project structure
1.6 Create"Hello Android World"application
77899
1.6. 1 Create a New Android Studio project
1.6.2 Create the source code of a simple FirstAndroidApplication Activity
13
1.6.3 Create the layout of the project
14
1 6.4 Android manifest
1. 6.5 Edit the FirstAndroidApplication dimensions
15
1.6.6 Edit the First AndroidApplication strings
I5
1.6.7 Add the drawable for every screen density
1.6.8 Build, compile and run
·
16
1.7 Download the Android Studio Project
18
l 8 How to col
18
2 Android Project migration from Eclipse to Android Studio
19
2.1 Why to use Android Studio over Eclipse ADT?
2.2 Android Studio new project structure
2.3 Gradle and build gradle
2.4 Simple Eclipse ADT project migration to Android Studio
2.5 Java code and resources migration
27
2.6 AndroidManifest xml and build gradle file
9
2.7 Download the Android Studio project
32
Android Programming cookbook
3 Android Google Maps v2 Tutorial
33
3.1 Create a Google Maps APl key
3.2 Create a New Android Application project
39
3.3 Importing Google Play Services in your project
46
3.4 Create the layout of the main Google Maps v2
3.5 Create the source code of the main Android GoogleMapsActivity
3.6 Creating the source code of the helper class CustomMarker java
58
3.7 Creating the source code of the helper class LatLngInterpolator java
.,59
3.8 Creating the source code of the helper class MarkerAnimation java
3.9 Modifying the AndroidManifest xml
63
3. 10 Build, compile and run
3.11 Download the Eclipse project
66
4 Android Start Service on boot example
4.1 Create a New android Studio project
67
4.2 Create the layout and the source code of a simple AndroidStartServiceOnBoot Activity
4.3 Creating the source code of the BroadcastReceiverOn BootComplete Service
4.4 Creating the source code of the AndroidService StartOn Boot Service
4.5 Editing the android manifest xm
4.6 Build, compile and run
4.7 Download the Android Studio project
79
3 Android Bluetooth Connection Example
5.1 Introduction
80
5.2 Create a New Android Studio Project
5.3 Create the lavout of the bluetooth chat
5.4 Create the source code of the bluetooth chat
85
5.5 Create the source code of the bluetooth Chat Service
90
5.6 Create the layout of the DevicelistActivity
96
5.7 Create the source code of the devicelistactivity
5.8 AndroidManifest xml
,,100
5.9 build gradle
5.10 Build, compile and run
5. 11 Download the Android Studio project
104
Android Programming cookbook
6 Android Multitouch Example
105
6.1 Create a New android Studio project
6.2 Create the layout of the project.........,..........
109
6.3 Creating the source code of the Touchable FrameLayout FrameLayout
110
6.4 Creating the source code of the main AndroidMultitouchActivity Activity
6.5 Create the strings. xml
115
6.6 Android manifest
115
6.7 build gradle
,115
6.8 Build, compile and run
116
6.9 Download the Android studio project
.118
7 Android Stack View Example
119
7.1 Create a New Android Studio project
9
7.2 Create the layout of the Android Stack view Activity
123
7. 3 Create the layout of the tack view items
124
7.4 Create the source code of the stackltems
.124
7.5 Create the source code of the Stack Adapter
124
7.6 Create the source code of the AndroidStack viewActivity
125
7.7 AndroidManifest xml
126
7.8 build gradle
127
7.9 Build, compile and run
7. 10 Download the Android Studio project
129
8 Android View Pager Example
130
8.1 Create a New Android Studio Project
130
8.2 Create the layout of the main Android View PagerExample
8.3 Create the source code of the main Android View PagerExample Activity
135
8. 4 Create the layout of the main fragment View Pager
136
8.5 Create the source code of the main Fragment View Pager support v4. app. Fragment
136
8.6 Android manifest
137
8.7 Composing build gradle file
,,138
8.8 Build, compile and run
.138
8.9 Download the Android studio project
143
Android Programming cookbook
V
Copyright (c) Exelixis Media P.C., 2016
All rights reserved. Without limiting the rights under
copyright reserved above, no part of this publication
may be reprcauced, stored cr introduced into a retrieval system, or
transmitted, in any form or by any means (electronic, mechanical,
photocopying, recording or otherwise), without the pricr written
permission cf the copyright owner
Android Programming cookbook
Preface
Android is a mobile operating system developed by Google, based on the linux kernel and designed primarily for touchscreen
mobile devices such as smartphones and tablets. Android's user interface is mainly based on direct manipulation, using touch
gestures that loosely correspond to real-world actions, such as swiping, tapping and pinching, to manipulate on-screen objects
along with a virtual key board for text input
In addition to touchscreen devices, Google has further developed Android Tv for televisions, Android Auto for cars, and android
Wear for wrist watches, each with a specialized user interface. Variants of Android are also used on notebooks, game consoles,
digital cameras, and other electronics
Android has the largest installed base of all operating systems of any kind. Android has been the best selling Os on tablets since
2013,andonsmartphonesitisdominantbyanymetric(soUrce:https://en.wikipediaorg/wiki/android_(operatinG_system))
In this ebook, we provide a compilation of android programming examples that will help you kick-start your own web projects
We cover a wide range of topics, from Services and Views, to Google Maps and Bluetooth functionality. With our straightforward
tutorials, you will be able to get your own projects up and running in minimum time
Android Programming cookbook
About the author
Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried
out a great variety of projects ranging from networking to software engineering
She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior
Software Engineer in the telecommunications area and currently works as an Android developer.
Android Programming cookbook
1/143
Chapter 1
Android Tutorial For Beginners
There are lots of reasons why more and more people are interested in learing how to be able to develop Android applications
Unarguably, Android is the most popular mobile operating system, with almost 2 billion devices activated and it offers a unified
approach to application development for mobile devices
That means, that developers need only develop for Android, and their applications will be able to ruin on different devices powered
by android. This particular asset gives Android endless possibilites! This means that and application that is designed to work on
mobile phone devices can be also transfered to android powered TV sets or Android Car systems
This is why, Android is an exciting space to make apps that can help you in every aspect of your life, can help you communicate,
organize, educate, entertain or just to make your life casier in every device that they might run on
In this special example, we are going to set our Android Development Studio IDE, make our very first Android application
and discover the Android Development world in the easiest possible way
The mobile development world can be very fun, because the direct results we see when creating our own application, can be
highly motivating and rewarding
1.1 What is android?
Android is a mobile operating system currently developed by Google, based on the linux kernel and designed primarily for
touchscreen mobile devices such as smartphones and tablets. And as we said before, Android offers a unified approach to
application development for mobile devices
Android is an open-source operating system named Android. Google has made the code for all the low-level"stuff"as well as the
needed middleware to power and use an electronic device and gave android freely to anyone who wants to write code and build
the operating system from it. There is even a full application framework included, so third-party apps can be built and installed
then made available for the user to run as they like
The "proper"name for this is the Android Open Source Project, and this is w hat people mean when they say things like android
is open and free. Android, in this iteration, is free for anyone to use as they like
1.2 Installing android studio
In order to write an Android application, we are going to need a development environment. Google has made a very useful
tool for all Android Developers, the Android Studio. Android Studio is the official IDE for Android development, and with a
single download includes everything you need to begin developing Android apps. Included in the download kit, are the Software
Development Kit (SDK), with all the Android libraries we may need, and the infrastructure to download the many Android
emulator instances, so that we can initially run our application, without needing a real device
So, we are going to download and install Android Studio
Android Programming cookbook
2/143
First we have to have installed the Java Development Kit (DK) from Oracle. If you do not, please you should download the
latest JDK from the Oracles special section here
L Android Studio 2.1.2
Android
Studio
Android studio
62 8A EVE TRs
Figure 1.1: Android Studio Installation-step I
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.