HTTPS clone URL
Subversion checkout URL
Beginning Android Resources
- Accessing the Camera and Stored Media
- ActionBar Tabs with Fragments
- ActiveAndroid Guide
- Activity Lifecycle
- Android Bootcamp Cliffnotes
- Android Design Guidelines
- Android Directory Structure
- Android Testing Framework
- Android Testing Options
- Android Unit and Integration testing
- Automating Publishing to the Play Store
- Basic Event Listeners
- Basic Painting with Views
- Basic Todo App Tutorial
- Beginning Android Resources
- Book Search Tutorial
- Building Data driven Apps with Parse
- Building Gradle Projects with Jenkins CI
- Building Simple Chat Client with Parse
- Circular Reveal Animation
- Clean Persistence with Sugar ORM
- Cloning a Login Screen Layout Guide
- CodePath Goal
- Collaborating on Projects with Git
- Common Implicit Intents
- Common Navigation Paradigms
- Communicating with an Event Bus
- Constructing View Layouts
- Consuming APIs with Retrofit
- Contributing back to Android
- Contributing Guidelines
- Converting JSON to Models
- Creating and Executing Async Tasks
- Creating and Using Fragments
- Creating Content Providers
- Creating Custom Listeners
- Debugging and Profiling Apps
- Defining Custom Views
- Defining The ActionBar
- Defining Views and their Attributes
- Dependency Injection with Dagger 2
- Design Support Library
- Developing Custom Themes
- Displaying Images with the Fresco Library
- Displaying the Snackbar
- Displaying Toasts
- Drawing with OpenGL and GLSurfaceView
- Dynamic Color using Palettes
- Easier SQL with Cupboard
- Endless Scrolling with AdapterViews
- Extended ActionBar Guide
- Extending SurfaceView
- Flexible User Interfaces
- Floating Action Buttons
- Fragment Navigation Drawer
- Free Android Curriculum
- Genymotion 2.0 Emulators with Google Play support
- Gestures and Touch Events
- Getting Started with Gradle
- Google Cloud Messaging
- Google Maps API v2 Usage
- Google Maps Fragment Guide
- Google Play Style Tabs using SlidingTabLayout
- Google Play Style Tabs using TabLayout
- Handling Configuration Changes
- Handling ProgressBars
- Handling Scrolls with CoordinatorLayout
- Heterogenous Layouts inside RecyclerView
- Implementing a Heterogenous ListView
- Implementing a Horizontal ListView Guide
- Implementing a Rate Me Feature
- Implementing Pull to Refresh Guide
- Installing Android SDK Tools
- Interacting with the Calendar
- Leveraging the Gson Library
- Listening to Sensors and Location
- Loading Contacts with Content Providers
- Local Databases with SQLiteOpenHelper
- Managing Threads and Custom Services
- Material Design Primer
- Menus and Popups
- Migrating to the AppCompat Library
- Mobile Screen Archetypes
- Must Have Libraries
- Navigation and Task Stacks
- Networking with the Volley Library
- Notification Services (GeoFence, Calendar)
- Open Source projects for Android development
- Organizing your Source Files
- Persisting Data to the Device
- Polishing a UI Tips and Tools
- Popular External Tools
- Populating a ListView with a CursorAdapter
- Progress Bar Custom View
- Publishing to the Play Store
- Push Messaging
- Real time Messaging
- Repeating Periodic Tasks
- Ripple Animation
- Robolectric Installation for Unit Testing
- Rotten Tomatoes Networking Tutorial
- Sample Android Apps
- Sending and Managing Network Requests
- Sending and Receiving Data with Sockets
- Setting up IntelliJ IDEA
- Setting up Travis CI
- Settings with PreferenceFragment
- Shared Element Activity Transition
- Sharing Content with Intents
- Sliding Tabs with PagerSlidingTabStrip
- Starting Background Services
- Storing and Accessing SharedPreferences
- Styles and Themes
- Styling UI Screens FAQ
- Troubleshooting Common Issues
- Troubleshooting Common Issues with Parse
- Troubleshooting Eclipse Issues
- UI Testing with Espresso
- UI Testing with Robotium
- Understanding App Permissions
- Understanding App Resources
- Unit Testing with Robolectric
- Using an ArrayAdapter with ListView
- Using Android Async Http Client
- Using Android Studio
- Using Context
- Using DialogFragment
- Using Intents to Create Flows
- Using OkHttp
- Using Parcelable
- Using Retrofit for REST Clients
- Using the CardView
- Using the RecyclerView
- Video and Audio Playback and Recording
- ViewPager with FragmentPagerAdapter
- Working with Input Views
- Working with the EditText
- Working with the ImageView
- Working with the ScrollView
- Working with the Soft Keyboard
- Working with the TextView
- Working with the WebView
Clone this wiki locally
This guide is not original content, instead this post is an amalgamation of numerous other guides discussing the process of learning Android. This guide currently incorporates content from the following list of sources:
HalfApp's "How to get started programming Android apps" blog post has been integrated into this article as well. We've also added resources of our own here including Java resources from this gist and links that we recommend to people when first learning Android.
Thanks to these original content authors for helping us put together this useful resource.
- Installation - If you have never done Android development, first setup your Android environment by following these Android Setup Slides
- Programming - If you are starting with no programming knowledge, we recommend you learn Java first (see resources in next section)
- First App - Consider starting by building a simple todo app by following these slides. Alternately try this video tutorial that will guide you through the basics of an Android app. I recommend that you not only watch the video but repeat what he is doing simultaneously.
- Finding Solutions - Learn how to search for solutions before you ask questions; check sources like StackOverflow and the cliffnotes for answers. Learn how to debug your code. This means using LogCat and reading stack traces, also learning how to use breakpoints.
- Reference Book - A great companion book is The Busy Coder's Guide to Android Development. If you don't want or can't buy the book, consider looking at its many code examples available for free
If you never programmed at all before or if you are interested in starting with the basics, spend the first few months just on learning Java. Learn the syntax and understand how everything works. You’ll need to be able to create classes, create and call methods, use interfaces as well as know how inheritance works, before you can go to the next step. These are the basics of Java, and you’ll use them extensively when developing Android apps. Helpful resources for learning Java:
- CodePath Java for Android Slides
- Programming by doing Java - Great step-by-step guide
- Head First Java Book
- The Java help subreddit
- The official Oracle Java tutorials
- TutsPlus Java Overview
- Learn Java Online - Interactive Java Tutorial
- Free Java Book - Solid online book
- Udemy Free Java Course - Free videos to learn Java
- CodingBat Java Exercises - Exercises to practice Java
- Best Ways to Learn Java Overview - Overview article
- Java Language Fundamentals
- Java: A Beginners Guide
- TutorialsPoint Java Guide
Be sure to check out these particular Java topics as well:
- Dealing with Exceptions
- Understanding Threads and Runnables
- Using Interfaces
- Using Event Listeners
- Creating your own Callbacks and Listeners
In addition to understanding Java and OOP, most Android development requires the use of data from a server-side database and as such requires you to have a solid conceptual understanding of RESTful APIs, consuming HTTP endpoints and parsing JSON responses. Here are a few resources to get started:
- Beginners Guide to REST
- Another Guide to REST
- Documentation for Twitter API
- JSON Overview Tutorial
- Parsing JSON in Java
You also need to know how to understand XML since a great deal of Android development takes place in XML files:
Once you understand Java, OOP (Classes, Inheritance, etc), XML and APIs with JSON, you now have the proper context to enter the world of Android development.
Understanding the concepts above is a good thing because it allows you search for practical ways to achieve something. Almost everything you can think of doing has already been tried and documented by someone else. You just need to know how to find it. Which leads me to my next set of things you may consider to learn first:
- Learn how to search -- I cannot stress this enough. Seriously, just Google it. If you are stuck or in doubt, search for your question. And most of all: Search before you ask.
- Learn how to debug your code There is a surprisingly high number of learners who do not debug their code at all and can't really understand their code's log. If you are using Eclipse, check this out
Speaking of Eclipse, an older IDE many people still use to program for Android, whether you want to use it or not is up to you. Eclipse is no longer in active development. Bear in mind the following though:
- The IDE most people talk about, Android Studio (which is based on IntelliJ), is now in a stable 1.0 release. The official Android page recommends new developers use this over eclipse.
- Most tutorials and documentation for beginners are still based on the use of Eclipse. All the resources I talk about here which are connected to an IDE, refer to Eclipse. However, this is changing as Android Studio is now the standard recommended by Google.
In terms of designing a good looking app, here are some links that will help you start looking at ideas and acquiring design assets like icons:
- Android App Patterns - Repository of Android interfaces for dozens of categories. Great way to explore the Android design standards
- MaterialDesignIcons - Good icons for material designed apps
- IconFinder - Excellent source of free to use graphics
- iconmonstr - Great source of icons with customized shapes and colors
- NounProject - Another source of free icons and graphics
- Icon Generator - Easily generate icons and images for use in your apps
- AndroidNiceties - Inspiring examples of Android app interfaces
- Android Design Principles
With the basics in mind, it is time to start coding your first Android app. To begin, download and install the Android Developer Tools. The Android SDK is actually a bundle of helpful tools consisting of Android libraries, an emulator, a debugger, and documentation. It also gives you a framework of Java classes and methods that all Android devices are able to use, the core Android library. You'll have to update this library as new versions come out, but more on that later. The whole SDK is neatly packaged inside Android Studio or Eclipse, allowing you to only worry about your code and how devices implement it.
When learning Android it’s not about learning how to code, it’s more about understanding the way Android works. That means that you’ll spend the majority of the time learning about Activity lifecycles, Fragments, ListViews, Intents, and other important Android specific concepts as opposed to complex algorithmic structures.
Consider starting with the following tutorials and resources:
The Android official training guides are a good place to start. The Building Your First App lesson is very easy to follow and already gives you a good understanding of some key concepts of the Android SDK.
The Android Development Tutorial by Derek Banas is great for those who prefer video lessons. It has 25 video lessons in total ranging from 10 to 30 minutes each. Note that he teaches in Eclipse instead of Android Studio.
CodePath Android Cliffnotes are what you are reading right now! Keep reading and hopefully you'll walk away feeling like you know more about Android than when you started.
Udacity Android Development for Beginners (Beginner) - This course is designed for students who are new to programming, and want to learn how to build Android apps. You don’t need any programming experience to take this course.
Developing Android Apps by Google (Intermediate) - Udacity course created by Google that teaches the core concepts involved in developing Android apps through videos and course work.
Google Android Glossary - Common Android terms defined in a glossary site with visual diagrams to help reinforce concepts.
Programming Android Applications on Coursera - Coursera online course from the University of Maryland.
CodeLearn Android Tutorial - Interesting interactive tutorial for learning Android step-by-step. Definitely worth a look as you build a twitter client step-by-step.
Android UI Tutorial: Layouts and Animationsa quick live coding of Android UI creations and shows how to use the different layouts, Views (TextView, ListView, ImageView, GridView, RecyclerView) and Motions (Property Animation, drawable Animation) by live coding.
Common tasks is a useful list from Google of typical things you can do in your app with links to explanations on how to do them.
Tasker is a great app available on the Google Play Store. This app won't teach you anything about how to develop Android apps but it will show you the many possibilities available to you in terms of what you can control on your device with an Android App. This app has A LOT of functionalities.
Building Mobile Applications Course - Courseware including videos and slides with high-level overview of Android development.
DevAppsDirect is another great app you can get from the Play Store. While it also won't teach you how to develop an app, it will show you what is available out there. The app maintains a list of open source libraries you can use in your project for a variety of purposes. Knowing what you can reuse will save you a lot of time in the future.
Android Programming: Pushing the Limits is a fairly good book to check out.
The Busy Coder's Guide to Android Development is comprehensive with its over 2,400 pages but starts with the basics. It also has "do-it-yourself" tutorials to help you retain what you are learning. The book is a bit expensive but it comes with a one-year subscription to keep it updated during the period, as the author is constantly adding to the text. All code examples are free and can be found here. Even if you don't buy the book, consider browsing through some of the examples there to learn how other programmers do things. Finally, Mark Murphy, the author of the book, is helpful whether you contact him by e-mail or on the StackOverflow website. Check out his profile.
If you run into issues as you are learning, you can check out codementor for online help.
The most common of these is caused by orientation changes. Whenever there is an orientation change, your activity needs to be destroyed and recreated to address the changes in layout. This means you need to handle this recreation process yourself, making sure your app doesn't crash. A lot of beginners (myself included) consider simply disabling these changes but this is consider a bad practice. Besides, even if you do disable orientation changes, there are other things that can cause configuration changes that you need to handle anyway.
Here are two good posts discussing this further: http://stackoverflow.com/a/582585/362298 and http://stackoverflow.com/questions/1111980/how-to-handle-screen-orientation-change-when-progress-dialog-and-background-thre
To force yourself to catch problems sooner than later, consider the following tip from a previous post here on Reddit. You can enable a developer setting to not keep activities, so that they are always destroyed and recreated.
And more specifically, here are two examples of dealing with this problem when using a FragmentPagerAdapter, a common use case:
In a more abstract sense but still related to the topic, an old post on avoiding memory leaks is probably worthy of your time as well. This was written by Romain Guy, a Google employee very active in the Android community. It is certainly worth following him on Google+.
You can pass Java objects from one activity to another in a Bundle if your class implements the Parcelable interface. Parcelables were designed specifically for performance and should almost always be used instead of Serializable. Here is a good page explaining how to use it.
You can also have inheritance while using it without adding too much of an overhead to the children like this post
One thing you MUST always keep in mind is the order with which you write to the parcel and read from it. That order must be consistent. Otherwise you will start getting very crypt error messages which are very hard to debug.
Android is full of features to help you deal with threads. This is a very important aspect of Android development because your app has to give snappy responses to user interaction. All your heavy work, such as database operations and network access, needs to be done in a separate thread so that the app does not appear frozen.
For this reason it is important to know when to use a
IntentService or an
AsyncTask. Learn about them, check examples, and make sure you use them whenever appropriate. Perhaps the best place to start is this post summarizing your options: http://techtej.blogspot.com.es/2011/03/android-thread-constructspart-4.html
Broadcast receivers are a great way to have your asynchronous tasks (refer to the previous topic above) communicate with the main thread or to receive push notifications from your phone. It is a powerful feature to understand and use.
According to the latest statistics I can see in my Developer Console, API 9 and above represents almost 97% of all active Android devices out there. The number of Android tablets is still much lower than that of Android phones. Take this year's Q1 sales for a reference. 28 million Android tablets were sold as opposed to 156 million Android phones sold in the same period.
Supporting older Android versions turned out to be easier than I thought initially. I am using the ActionBarSherlock for providing the same UI experience in terms of ActionBar layout. I know now that the official Android Support Library has a similar library called ActionBarCompat which is probably worth considering to avoid relying too much on third-party libraries.
Aside from the ActionBarSherlock, though, most things in the UI can done to all API levels using the Support Library. You just have to make sure to use the right sets of classes. For example, instead of using "android.app.Fragment" when creating a new fragment, you use android.support.v4.app.Fragment instead.
Created by CodePath with much help from the community.