Statistics
2
Views
0
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2026-02-16

AuthorSwift Os.

CreateSpace Independent Publishing Platform, 2015. — 145 p. — ISBN-10: 1517640091. — ISBN-13: 978-1517640095. — 2nd EditionBest Seller! - Learn to Program Android Apps - in a Day! 2nd Edition What can this book do for you? Android: Programming Guide: Android App Development - Learn in a Day teaches you everything you need to become an Android App Developer from scratch. It explains how you can get started by installing Android Studio and learning to use the Android SDK Manager. Can you really create an app in just a day? Yes, you can! With Android: Programming Guide: Android App Development - Learn in a Day, you’ll learn to create “OMG Andriod”. This app is similar to the “Hello, World” program that many beginners create when learning new computer languages. Soon, you’ll have your very own app that greets you by name! Can you create an app and try it out on your personal Android device? Absolutely! Android: Programming Guide: Android App Development - Learn in a Day teaches you to run your app on emulators and devices, and how to put personal touches on your app. You’ll learn how to update your apps with the Android SDK Manager, use XML, and add buttons and listeners! There’s so much you can learn from this essential book - order your copy TODAY! Contents Android Overview Android Architecture Android Software Development Rooting How to Become an Android App Developer from Scratch Getting Started The Android SDK Manager Let’s Create OMG Android Important Application Files Running Your App on an Emulator or Device Organize resources in Android Studio Updating With the SDK Manager XML Layout Basics Buttons and Listeners Adding Visual and Nested Layouts Involving the Keyboard The ListView Detecting List Selections The Action Bar Remembering Your Name Android: How to develop a simple calculator Android: A login application Android Animations

Tags
No tags
Language: 英文
File Format: PDF
File Size: 938.5 KB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
Android Programming Guide Android App Development Learn In A Day! 2nd Edition By Os Swift
© Copyright 2015 by Os Swift- All rights reserved. In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved. The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly. Respective authors own all copyrights not held by the publisher. Legal Notice: This book is copyright protected. This is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part or the content within this book without the consent of the author or copyright owner. Legal action will be pursued if this is breached. Disclaimer Notice: Please note the information contained within this document is for educational and entertainment purposes only. Every attempt has been made to provide accurate, up to date and reliable complete information. No warranties of any kind are expressed or implied. Readers acknowledge that the author is not engaging in the rendering of legal, financial, medical or professional advice. By reading this document, the reader agrees that under no circumstances are we responsible for any losses, direct or indirect, which are incurred as a result of the use of information contained within this document, including, but not limited to, —errors, omissions, or inaccuracies.
Contents Introduction Chapter 1: Android Overview Chapter 2: Android Architecture Chapter 3: Android Software Development Rooting Chapter 4 – How to Become an Android App Developer from Scratch Chapter 5 - Getting Started Chapter 6 - The Android SDK Manager Chapter 7 - Let’s Create OMG Android Chapter 8 - Important Application Files Chapter 9 - Running Your App on an Emulator or Device Chapter 10: Organize resources in Android Studio Chapter 11 - Updating With the SDK Manager Chapter 12 - XML Layout Basics Chapter 13 - Buttons and Listeners Chapter 14 - Adding Visual and Nested Layouts Chapter 15 - Involving the Keyboard Chapter 16 - The ListView Chapter 17 - Detecting List Selections Chapter 18 - The Action Bar Chapter 19 - Remembering Your Name Chapter 20: Android: How to develop a simple calculator Chapter 21: Android: A login application Chapter 22: Android Animations Conclusion
(This page has no text content)
Introduction Right now, Android app development is in huge demand and the result is that the platform with the funny green robot is turning into one of the major options, instead of taking second place to Apple’s iOS. There are more than a billion Android devices activated today, making it an exciting place to turn your dream into an app; an app that can help you to organize, communicate, educate, entertain, or anything else you can possibly think of. There really are no limits when it comes to designing an app for the Android platform and turning it into reality is not much more difficult than coming up with the idea in the first place! If you want a few more reasons why you should choose Android, try these on for size: Android has, at the time of writing, the biggest market share of smartphones and tablets in the world. Android has a policy on app provisioning and submission that s way more open that iOS. This means that, once your app is complete – and I will be walking you through your first one in this book – you can get it out into the market and onto people’s devices immediately It isn’t all about the iPhone anymore. There are so many more devices on the market these days and Android is installed on a very large number of them. That makes it one of the most important platforms for you to begin your journey on. So, if you have been toying with the idea of creating an app for Android, this is the book for you. I am going to tell you exactly how to get started and show you how to create your very first app.
(This page has no text content)
Chapter 1: Android Overview Android is an operating system for mobiles developed by the Google Corporation. Android is a Linux kernel based operating system. The user interface of the android operating system is direct manipulation based. This is primarily designed for touchscreen smartphones and tablets. Apart from these, android can also be used for wristwatches (Android wear), televisions (Android TV) and cars (Android auto). The operating system makes use of the touch inputs which loosely correspond to the real world actions, like pinching, tapping, swiping and reverse pinching for manipulating the virtual keyboard and the on-screen objects. This is not all, android is also used with digital cameras, gaming consoles, personal computers and a few other electronics. Of all the operating systems in the market, Android holds the largest installed base. Android is a customizable, ready-made and low-cost operating system that can be used with high-tech devices and for this reason it is popular with technology companies. Android is open source and this encouraged a huge community of enthusiasts and developers to use its code for developing community driven projects with which they can add additional features for advanced users. They can also install android on devices that run on other OS.
Features of Android Android is a flexible and powerful OS that is competing with the Apple iOS and other such operating systems like Windows 8.1. Few of its features are given below. Feature Description Beautiful UI The basic screening of the android operating system provides an intuitive and beautiful user interface. Connectivity CDMA, UMTS, GSM/EDGE, LTE, EV-DO, Wi-Fi, NFC, Bluetooth, IDEN and WiMAX. Storage Android uses a lightweight relational database called the SQLite for storing data. Media support H.263, H.264, AMR, AMR-WB, MPEG-4 SP, AAC 5.1, AAC, HE- AAC, MIDI, GIF, WAV, Ogg Vorbis, PNG, MP3, BMP and JPEG Messaging MMS and SMS Web browser The web browser of android is based on the WebKit layout engine and is coupled with the V8 JavaScript engine of chrome, supporting the CSS3 and HTML5. The WebKit layout engine is an open source engine. Multi-touch Multi touch is natively supported by android and it was available initially with the mobiles like HTC hero. Multi- tasking Users can navigate from one application to another application and multiple applications can be run simultaneously at the same time. Resizable widgets The default widgets and the widgets you download can be resized. They can be made smaller to save space or they can be expanded to show more content. Multi- Language Single and bidirectional text is supported by android.
GCM Using the Google Cloud messaging, developers can send short messages to the android users. This doesn’t need a proprietary sink solution. Wi-Fi Direct Wi-Fi Direct is a technology that lets applications to pair directly enabling a high-speed peer to peer connection after discovering. Android Beam Android Beam is based on the near field communication technology. Users can share data instantly just by touching the two devices which has NFC enabled on them. After developing an android application, it can be packaged and sold easily either through the Google play store, Mobango, Amazon Appstore, slide ME, Opera mobile store or F- droid. Android is running currently on billions of devices that include tablets, mobile phones, TVs etc. It is used in almost 200 countries around the globe. Android is the largest mobile platform base and it is yet growing fast. According to the Google Corporation, more than 1,000,000 new android devices are activated daily. What is API level? API Level is the number given to the framework API revision for its unique identification. The android platform offers these. Platform Version API Level VERSION_CODE Android 5.1 22 LOLLIPOP_MR1 Android 5.0 21 LOLLIPOP Android 4.4W 20 KITKAT_WATCH KitKat for Wearables Only
Android 4.4 19 KITKAT Android 4.3 18 JELLY_BEAN_MR2 Android 4.2, 4.2.2 17 JELLY_BEAN_MR1 Android 4.1, 4.1.1 16 JELLY_BEAN Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1 Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH Android 3.2 13 HONEYCOMB_MR2 Android 3.1.x 12 HONEYCOMB_MR1 Android 3.0.x 11 HONEYCOMB Android 2.3.4 Android 2.3.3 10 GINGERBREAD_MR1 Android 2.3.2 Android 2.3.1 Android 2.3 9 GINGERBREAD Android 2.2.x 8 FROYO Android 2.1.x 7 ECLAIR_MR1 Android 2.0.1 6 ECLAIR_0_1 Android 2.0 5 ECLAIR
Android 1.6 4 DONUT Android 1.5 3 CUPCAKE Android 1.1 2 BASE_1_1 Android 1.0 1 BASE Interface The default android user interface is based on touch inputs, direct manipulation actions like pinching, swiping, and reverse pinching for manipulating the on-screen objects and virtual keyboard. Android is designed in such a way that the response to the user’s input is immediate, along with a smooth touch interface. The android operating system also uses the vibration feature of the device for providing the user with haptic feedback. Internal hardware like proximity sensors, gyroscopes and accelerometers can be used by the applications. This internal hardware can be used for adjusting the screen orientation using the gyroscope; Control remote controlled using the accelerometer etc. Home screen can be made up of different pages, which the user can select and add. They can swipe through the home screens. Users can add additional widgets or application shortcuts on different home screens matching their taste. Memory management Most of the android devices or all of the android mobile devices run on battery. So, for increasing the battery life, the RAM should consume as less power as possible as they are not like the desktop devices which can have a continuous power supply. Whenever an android app is minimized or when it is no longer in use, it will be suspended in the memory automatically. Technically speaking, these applications will be still open but they cannot consume the system resources. They will wait in the background till the user calls for them again. This gives the users a benefit where they need not close the application and start everything from the beginning. The second benefit of this is that the applications running in the background do not consume system resources unnecessarily. Android is very good with managing applications. If the memory is low, android will simply terminate the processes and applications that are inactive. It will perform this in the reverse order of their last usage; the oldest applications will be closed first. All of these processes will be running in the background and the user cannot see it. This leaves the user the pain of managing the apps as Android automatically terminates the applications.
Open-source community The android community can be called as the most active community where many enthusiasts and android developers use the source code of the Android Open Source Project, AOSP. They use it for developing and distributing their own versions of the modified operating system. The releases made in the community are often faster compared to the official releases. The updates that are released by the developers are not extensively tested like the official manufacturer’s release versions. There are many developers who release their updates for devices that are no longer supported by the manufacturers. Security and privacy Android applications run in a sandbox, an isolated area of the system that does not have access to the rest of the system’s resources, unless the user explicitly grants access permissions when the application is installed. Before installing an application, Play Store displays all required permissions: a game may need to enable vibration or save data to an SD card, for example, but should not need to read SMS messages or access the phonebook. After reviewing these permissions, the user can choose to accept or refuse them, installing the application only if they accept. The sandboxing and permissions system lessens the impact of vulnerabilities and bugs in applications, but developer confusion and limited documentation has resulted in applications routinely requesting unnecessary permissions, reducing its effectiveness. The advantages of the android are many and the android operating system is used on more than a billion tablets and smartphones. Supports 2D, 3D graphics The android OS supports platforms like 2D and 3D. Earlier, we only used to watch videos or play games in 2D. The situation is different now and many applications are using the 3D format for better user experience. The android operating system supports 3D format along with 2D format, providing the users with a better experience when using gaming and video applications. Supports Multiple Languages Android supports many languages. Almost all of the majorly used languages are supported and the list goes more than 100. With this feature android can easily adapt We can say all famous languages about more than 100. By using this feature it is easy to adapt to different languages. Earlier in the feature phones English is to be the only
language in the mobile devices. Java Support Android supports Java enabling the Java developers to add additional features. The operating can be deployed as it supports Java Faster Web Browser Android operating system comes with preloaded web browser that can be used for surfing the Internet without complexity. It is similar to that of a computer. Multimedia on the web pages will be loaded easily, resulting in the faster web browsing. It Supports MP4, 3GP, MPEG4, MIDI Different video formats are supported by the Android OS. In fact, almost all of the video formats are supported. This will rule out the pain of converting the video into a computable format. Android also supports a wide range of audio formats. Additional Hardware Support A new hardware can be connected easily with devices running on android. A device can be connected internally, providing we use it with additional features. Android extends its support to a wide range of hardware devices. Video Calling Video calls can be made with faster data connections. The new generation networks and bandwidth can be taken advantage of using the android operating system. Open Source Framework It makes users to make their own applications and to make changes required for them. Enthusiasts can make Android more powerful and useful by developing themselves. As it is an open source operating system, we can use it easily and without cost in the equipment. Uses of Tools are Very Simple In android, a single button can be used for multiple purposes and it can perform more tasks than for which it is assigned to. For instance, the volume button can be used for capturing a photo just by changing a simple algorithm.
Availability of Apps There are millions of applications available free of cost in the Google play store. Users have the freedom of installing applications from third-party publishers. Great Social Networking Integration Multiple social networking websites can be integrated and their features can be enhanced. This will make it easy for a user to check his social networking accounts easily. By using the user enabled development, users can customize the features and applications. Better Notification System Users can directly check the important notifications from the dashboard, making work easier. Earlier, we had to open the application and refresh it for checking updates. Updated User Interface Design Interfacing, the user to device interfacing can be updated in the android operating system. The addition of touchscreen can be considered as a revolution and it changed the way people using mobiles. Features like typing and can be effectively performed on a device running on the android operating system. At a Time Applications Android allows users to run multiple applications at the same time. This will help the users in saving their efforts and time. Low Chance of Crashing The android operating system is smooth and it is very easy to operate. The chances of crashing are less. Stability The security and stability of the android OS is superior compared to the other mobile operating systems. The android operating system is based on the Linux kernel and it is the reason for its stability. Any operation that is performed will go into the command mode. If there are any security threats detected, it will go into the basic mode and stores to other applications like cloud computing and it will crash the data stored on the device.
You can change your settings quicker The settings can be changed quickly. By using different tasks and apps, we can use the android OS. More options with limited budget Compared to other operating systems, android is cheaper and it gives a better performance at the same time. It is open framework and open source. Android provides support for larger resolutions and screens. Users can enjoy clear and bright formats with android’s support for different screen sizes for enhanced resolutions and applications. Copy paste functionalities throughout the system Earlier, we were only allowed to copy and paste in a single application. Developers thought of changing this and planned to make the whole phone operating as a computer based OS. For this, the android OS came with the copy and paste option throughout the system. Editing is made simpler with this. Redesigned Multi Touch Software Keyboard Android gave users more freedom by providing them redesigned keyboards like Google keyboard, different types of qwerty keyboards etc,. There are a number of smart keyboards available now that made vast changes in the way users type. Typing has been made easy by using the dictionary that suggests users with words and the AutoCorrect option corrects misspelled words. Additional features like drag and detect has brought a revolution in the area of mobile typing. Audio, Graphical and Input Enhancements for Game Developers A number of changes were made by android in the multimedia used for the mobile devices. Using different audio enhancements enhances the audio quality of the device. Improved Power Management and Application Control The android application control and power management only allows currently running application to use the RAM memory and power. All the other applications will run in the background and will wait for the user to use them. After the user switching to a different application, the system will allocate power and memory using this method. The system memory and power can be saved using the improved power management and application
control. The enhanced application control now supports multiple cameras.
(This page has no text content)
Chapter 2: Android Architecture Before going deep into the android development, firstly you should know the basic internal architecture. The application framework can be understood easily if you know how things work and how they are arranged. Applications can be designed in a better way by knowing these two things. Since the android operating system is based on the Linux OS, it is very much similar to the Linux operating system. The architecture of android is illustrated in the following figure. OEMs provide the software stocks that are above the hardware. The applications are the topmost layer.
Android Architecture Basic Applications For instance, four basic apps like App 1, App 2, App 3 and App 4are depicted like any android user interface. Applications like camera, music player, Application for making calls and so on are some of the apps. These applications can be from providers other than Google, Google doesn’t necessarily provide these apps. By using the Google play store, you can develop an application and can place it there, making it available for all. You can develop to the applications in Java and install them directly without needing to integrate with the android operating system. Application Framework The application framework is used for developing applications. Developers for developing applications use the framework. The framework offers a number of interfaces and the developers of different standards use these interfaces. By using the frameworks you need not code every basic task. There are different entities in the framework and they are as follows. Activity Manager The activity manager is responsible for managing the activities that control the app lifecycle and it has many states. The applications may consist of multiple activities that include their own application life cycle. Whenever an app is launched, one main activity