├── .gitignore ├── gettingStarted └── README.md ├── listViews ├── screenshots │ └── appRun.png └── README.md ├── buttonsAndToast ├── screenshots │ └── appRun.png └── README.md ├── firstAndroidApp ├── screenshots │ ├── appRun.png │ ├── layout.png │ ├── mainScreen.png │ ├── chooseDefault.png │ ├── targetDevice.png │ ├── welcomeScreen.png │ └── emptyActivityName.png └── README.md ├── intentsPassingDataMultipleActivities ├── screenshots │ └── appRun.gif └── README.md ├── recyclerViews └── README.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *.swp 3 | -------------------------------------------------------------------------------- /gettingStarted/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | Work in progress. Will fill this out 3 | -------------------------------------------------------------------------------- /listViews/screenshots/appRun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/listViews/screenshots/appRun.png -------------------------------------------------------------------------------- /buttonsAndToast/screenshots/appRun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/buttonsAndToast/screenshots/appRun.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/appRun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/appRun.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/layout.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/mainScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/mainScreen.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/chooseDefault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/chooseDefault.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/targetDevice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/targetDevice.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/welcomeScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/welcomeScreen.png -------------------------------------------------------------------------------- /firstAndroidApp/screenshots/emptyActivityName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/firstAndroidApp/screenshots/emptyActivityName.png -------------------------------------------------------------------------------- /intentsPassingDataMultipleActivities/screenshots/appRun.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/savala/tilAndroid/HEAD/intentsPassingDataMultipleActivities/screenshots/appRun.gif -------------------------------------------------------------------------------- /recyclerViews/README.md: -------------------------------------------------------------------------------- 1 | # RecyclerView 2 | RecyclerViews the new way and improved way to do ListViews. This tutorial assumes that you know how to use ListViews, that you're comfortable with layouts, and can create an "empty" project 3 | 4 | ## Getting Started 5 | Go ahead and create a new Android Studio project. Set your activity type that's generated to be an Empty Activity. 6 | 7 | 8 | Once that's done open up `build.gradle (Module: app)` and enter in the following inside of the `dependencies` section 9 | 10 | 11 | ```gradle 12 | compile 'com.android.support:recyclerview-v7:23.0.1' 13 | ``` 14 | 15 | 16 | If you did that correctly your gradle file should like the one below and should sync up correctly 17 | 18 | 19 | ```gradle 20 | apply plugin: 'com.android.application' 21 | 22 | android { 23 | compileSdkVersion 23 24 | buildToolsVersion "23.0.1" 25 | 26 | defaultConfig { 27 | applicationId "ssa766.myapplication" 28 | minSdkVersion 16 29 | targetSdkVersion 23 30 | versionCode 1 31 | versionName "1.0" 32 | } 33 | buildTypes { 34 | release { 35 | minifyEnabled false 36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 37 | } 38 | } 39 | } 40 | 41 | dependencies { 42 | compile fileTree(dir: 'libs', include: ['*.jar']) 43 | testCompile 'junit:junit:4.12' 44 | compile 'com.android.support:appcompat-v7:23.0.1' 45 | compile 'com.android.support:recyclerview-v7:23.0.1' 46 | } 47 | ``` 48 | 49 | 50 | ## RecyclerView 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Today I Learned Android 2 | I fell in love with Android App development ever since I first started building stuff on it since my senior year of high school in 2010-2011. While in college a few of my friends and I started an organization that teaches students Android, iOS, and Webapp Development, and it was one of the things that I'm most proud of. Since graduating I wanted to spread the love a bit more and use this repo to provide mini tutorials for Android App development. 3 | 4 | 5 | This is a work in progress so please bear with me. My goal is to have at least two new tutorials each week. If you have any tutorial requests and such, feel free to open up an issue and place your request there! Or, if you'd like submit your own tutorial as a pull request! 6 | 7 | # Beginner Tutorials 8 | 1. [Getting Started](gettingStarted/README.md) (Todo) 9 | 2. [First Android App](firstAndroidApp/README.md) 10 | 3. [Buttons and Toast](buttonsAndToast/README.md) 11 | 4. [ListViews](listViews/README.md) 12 | 5. [Intents and Passing Data between Multiple Activities](intentsPassingDataMultipleActivities/README.md) 13 | 6. [RecyclerViews](recyclerViews/README.md) (Todo) 14 | 7. [Android Themes](themes/README.md) (Todo) 15 | 8. [Styles](themes/README.md) (Todo) 16 | 17 | # Advanced Tutorials 18 | 1. [Android Development Patterns](androidDevelopmentPatterns/README.md) (Todo) 19 | 2. [Custom ListViews](customListViews/README.md) (Todo) 20 | 3. [REST Tutorial](restTutorial/README.md) (Todo) 21 | 4. [Custom Views](customViews/README.md) (Todo) 22 | 5. [Animated Vector Drawables](animatedVectorDrawables/README.md) (Todo) 23 | 24 | # Android Libraries 25 | 1. Picasso 26 | 2. Retrofit 27 | 28 | # Contributing 29 | If you would like to contribute, have any complaints, or just want to reach out feel free contact me, @savala 30 | -------------------------------------------------------------------------------- /listViews/README.md: -------------------------------------------------------------------------------- 1 | # ListViews 2 | This tutorial teaches you how to create ListViews with string objects. We'll be using ArrayAdapter, ArrayList, and the ListView view item. 3 | 4 | 5 | Let's get started. Go ahead and create a new Android project in Android Studio. Make sure to choose "Empty Activity" as your activity type and leave everything as default. 6 | 7 | ## Add ListView to Layout 8 | Remove the TextView tag and add in the ListView tag in your activity_main.xml file 9 | 10 | 11 | ```xml 12 | 16 | ``` 17 | 18 | 19 | What we're doing here is creating a ListView with a reference point of "listView" as the id. We're also setting the width and height to fill up the entire space. After adding the ListView tag, your activity_main.xml file should look like the following 20 | 21 | 22 | ```xml 23 | 24 | 33 | 34 | 38 | 39 | ``` 40 | 41 | ## Add Data to the ListView 42 | Now that we have the ListView in our layout, we need to have some data to show within the ListView. To do this, first navigate to MainActivity.java 43 | 44 | 45 | First declare the ListView, ArrayAdapter, and ArrayList outside of the onCreate() function 46 | 47 | 48 | ```java 49 | ListView listView; 50 | ArrayList data; 51 | ArrayAdapter arrayAdapter; 52 | ``` 53 | 54 | 55 | Inside onCreate() add the following 56 | 57 | 58 | ```java 59 | listView = (ListView) findViewById(R.id.listView); 60 | 61 | data = new ArrayList(); 62 | 63 | // Create some dummy data with numbers 64 | for (int i = 0; i < 40; i++) { 65 | data.add(String.valueOf(i)); 66 | } 67 | 68 | // Initialize the ArrayAdapter, set the context, layout, and data 69 | arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, data); 70 | 71 | // Tell the listView what adapter it's using 72 | listView.setAdapter(arrayAdapter); 73 | ``` 74 | 75 | ## Run the App 76 | Now run the app and if your output looks something like the below image then you're done! 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /firstAndroidApp/README.md: -------------------------------------------------------------------------------- 1 | # Creating your first Android App 2 | This tutorial is to get your started with loading up a default Android App and being able to run the application. Note this assumes that you have the sdk installed. If not please feel free to check out the [getting started tutorial](../gettingStarted/README.md). 3 | 4 | ## Getting Started 5 | When you first open up Android Studio, you'll be presented with a welcome screen like so 6 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/welcomeScreen.png "Welcome Screen") 7 | 8 | 9 | Go ahead and click on "Start a new Android Studio project" and then you will be presented with a screen that tells you to choose the target Android devices that you want your app to be compatible with 10 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/targetDevice.png "Target Devices") 11 | 12 | 13 | Click next and then you'll see a screen that asks you to add a new activity 14 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/chooseDefault.png "Choose Activity") 15 | 16 | 17 | Choose Empty Activity and then proceed further and define the Activity Name and Layout Name. Go ahead and leave the default values 18 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/emptyActivityName.png "Main Activity Name") 19 | 20 | 21 | Click finish and you'll then see Android Studio do a bunch of stuff and you'll be presented with all the code and goodies to get going with your Android App! 22 | 23 | ## Quick Description everything 24 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/mainScreen.png "Main Screen") 25 | 26 | 27 | Take a look at the left side of the screen. You'll see a list of all the files that make up your Android App on the left. You'll notice AndroidManifest.xml, java folder, and the res folder. Don't worry about everything yet, I'll go into more details about these in later tutorials. For now understand that the AndroidManifest is where you'll declare your activities and various permissions that your app has. The java/ folder will contain all your java code haha. The res/ folder contains your images, layouts, strings, styles, and various other files that will help you define your UI. 28 | 29 | 30 | Now take a look at the editor. You'll notice MainActivity.java and activity_main.xml. In android you'll define your layouts and "views" within xml. You can avoid doing this in xml, but for now go ahead with this. The way I like to think about it is: define your layouts / UI in xml, and then use Java to go and maninpulate them. 31 | 32 | ## activity_main.xml 33 | ![alt text](https://github.com/savala/tilAndroid/blob/master/firstAndroidApp/screenshots/layout.png "Layout") 34 | 35 | 36 | This might look kind of confusing at first, but don't worry about it. What this is doing here is setting the type of layout you want (RelativeLayout) and then putting a TextView tag. In Android, the various elements that you see on screen are "views". There's TextView (show plain text), Button, EditText (input box), ListView (show lists), and much more. 37 | 38 | ## MainActivity.java 39 | Now that you kinda know what the layout file does, how can we manipulate it? Well this is where MainActivity.java comes in. Notice here you'll see 40 | ```java 41 | public void onCreate(Bundle savedInstanceState) { 42 | ... 43 | } 44 | ``` 45 | 46 | onCreate() is essentially like the main() function in java. This is the function that's called when you launch your app. If you were wondering how this java file knows to interact with the layout file, notice in the onCreate() function there's a line that says 47 | 48 | ```java 49 | setContentView(R.layout.activity_main); 50 | ``` 51 | 52 | 53 | What is R? Well when your app is built, any references that you have defined in xml and such can be referred using the R.java file. So if I create more layouts like "xyz.xml" I can refer to it by using R.layout.xyz. As this 54 | 55 | 56 | With the above line you're essentially enabling the MainActivity.java access to manipulate the ui elements that you've defined in activity_main.xml 57 | 58 | ## Running the App 59 | Go ahead and press the green "play" button in Android studio. If you have the Android sdk installed and have a virtual device created, then the app should build and then launch. If successful you should see something like this: 60 | 61 | 62 | 63 | And you've just run your first Android App! 64 | -------------------------------------------------------------------------------- /buttonsAndToast/README.md: -------------------------------------------------------------------------------- 1 | # Buttons and Toast 2 | This tutorial teaches you about how to add buttons in your Android App and then manipulate them using java. This tutorial assumes that you know how to create a base project. So go ahead and create a new Android project, make sure to choose Empty Activity as the activity type, and then leave the defaults for everything else. 3 | 4 | ## Add a button to your layout 5 | The default activity_main.xml file looks like this: 6 | 7 | ```xml 8 | 9 | 18 | 19 | 23 | 24 | ``` 25 | 26 | 27 | Go ahead and remove the TextView tag and add in the Button tag as below: 28 | 29 | ```xml 30 |