Post: Getting Started With Android Programming
03-28-2015, 02:52 AM #1
Mr Smithy x
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({}); Hey NextGen, I've recently decided to help the community get started with the android sdk.Tustin
I've been getting request on how to make android apps so i'll start you out with the basics and add more gradually.
In order for you to get started you need You must login or register to view this content. and some background in java is required otherwise you will just copy what i do and try and play with it.

Java Help (Credits to primetime43):
You must login or register to view this content.
You must login or register to view this content.

Getting Started

On the android studio home you will need to create a new project
You must login or register to view this content.

Name your project:
You must login or register to view this content.

Usually i'd have my api level up to 4.4 kitkat but you can go ever low you want. lowest i would go wout be api 14 on 4.0.
You must login or register to view this content.

Select blank activity and hit next
You must login or register to view this content.

Hit next on this screen
You must login or register to view this content.

If you are having trouble viewing the preview, select an api that suits you. In this case, api 21 fits my preview well
You must login or register to view this content.

On the left you have all your project files, middle is usually where you write your code.
In layouts, you will have a design tab and a text tab at the bottom, you cans switch between each other
You must login or register to view this content.


On our design tab you, you will have a visual studio/netbeans like gui designer where you can drag views onto the screen
You must login or register to view this content.

What i want you to do is drag a button onto the screen and move the text to the center so you will have a better feel of how it operates. It takes a while to get use to.
You must login or register to view this content.

Click on the click button and you will see properties on the bottom right. Give the button a custom text.
You must login or register to view this content.

Scroll up and give the button an id, you will use that id in the code, also click on the TextView and give that an id called "textview"
You must login or register to view this content.

Here we have the onCreate Method where we initialize our views and populate the activity activity
You must login or register to view this content.

In this image we initialize out views, having out view global so it can be accessed anywhere within the class
You must login or register to view this content.

Now here we implement an interface, hitting alt enter will solve your problems. When adding the interface, it implements the methods to override so you can use that for your view. In this case we will use OnClickListener for the button. Notice how we use "this", the reason we did that is because this class implements the method we will be overriding. Typically you would use the OnClick method this way but for speed you can test.
You must login or register to view this content.

Run the app/emulator and see what you come up with, here we have our default untouched activity
You must login or register to view this content.

Once clicked it will bring up a toast saying hello world as well as changing the text of the textview
You must login or register to view this content.


Beginner/Intermediate Tutorials
***Newest:
You must login or register to view this content.
Model View Controller:
Outcome:


Project Download:
You must login or register to view this content.



Sources:
PDF Reader
You must login or register to view this content.

You must login or register to view this content.


You must login or register to view this content.


Credits:
Mr Smithy
Google
The guy who made android but idk his name.Tustin

Sorry for the sloppyness, it was a bit rushed, make a request if you want a tutorial done on something.
Last edited by Mr Smithy x ; 10-11-2015 at 03:50 PM.

The following 7 users say thank you to Mr Smithy x for this useful post:

BISOON, Im_YouViolateMe, ResistTheNeptune, RTE, Sloth, TehMerkMods, xDebugKiller
02-11-2017, 03:38 PM #20
Whats the source of an toast...

I wanna add some toasts

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo