Basic Setup
- Install Android Studio
- Get the required SDK - I got the latest SDK for 4.4
- Gradle build tool is bundled with Android Studio? (Maybe, I don't know)
- Create the Android Virtual Devices (emulator) for testing - use the AVD manager (the AVD manager can also be launched from inside Android Studio, as can the SDK Manager)
- You may need to install the correct CPU/ABI for the emulator from the SDK Manager.
- Launch the AVD - you will probably need to set the RAM on the emulator to a low value (200MB) for the device emulator to launch in a decent time.
Basic development process
- Write code - target a particular version of the Android SDK
- Launch emulator
- Run code. this will:
- compile and create an APK
- install the APK in the emulator
- launch the app
Structure of an Android HelloWorld App
public class Greetings extends Activity
- An Activity represents a screen in the UI
- Contains a bunch of on* methods (onCreate, onCreateOptionsMenu, ...) which will be invoked when specific events happen.
AndroidManifest.xml
- Declares various components (including Activities) which are to be a part of the application.
- Various important pieces:
- uses-sdk - which sdk the application can work with (max, min,...)
- application - defines the application, contains the various components like activities, services, etc.
- activity (inside application) - defines a screen
- intent-filter (inside activity, can it be in other places?) - defines what events the activity will listen for?
The res/ Directory
- Contains various resources needed by the application
- drawable-* : different images to be drawn, based on screen resolution
- layout - contains layouts for various activities - how to layout the screen
- menu?
- values/strings.xml - different strings to be used in the application
R Generated class
- Generated during build - do not hand edit.
- Contains various strings/resources/etc. - can be used in the application.
No comments:
Post a Comment