Crash Fast - Square’s approach to Android crashes - Devoxx Be 2014
Mobile Software Engineering Crash Course - C03 Android
-
Upload
mohammad-shaker -
Category
Education
-
view
121 -
download
7
description
Transcript of Mobile Software Engineering Crash Course - C03 Android
Mohammad Shaker
FIT of Damascus - AI dept.
Mobile SE –August 2012
Mobile
Software
Engineering
L03 –Android
Android Developerhttp://developer.android.com
SDK Downloadhttp://developer.android.com/sdk/index.html
eclipse Android plugininstructions @ http://developer.android.com/tools/sdk/eclipse-adt.html
Crazy Stuffhttp://www.xda-developers.com/
Constraints
• No support for placing or receiving actual phone calls.
• You can simulate phone calls (placed and received) through the emulator console, however.
• No support for USB connections
• No support for camera/video capture (input).
• No support for device-attached headphones
• No support for determining connected state
• No support for determining battery charge level and AC
charging state
• No support for determining SD card insert/eject
• No support for Bluetooth
Tools
• android - Android SDK manager. Create/delete/view Android Virtual Devices and update the SDK with new platforms/add-ons.
• ddms - Dalvik Debug Monitor Server. Screen caps, thread/heap info, process/state info, ..
• emulator - The application responsible for opening AVDs instances.
• sqlite3 - manage SQLite databases.
SDK – Cont.
• # adb - Android Debug Bridge. A
client/server program that manages
the state of an emulated device.
• # aapt - Android Asset Packaging Tool.
• # dx - The converter; converts .class
files to Android bytecode.
First sight
First sight
Activity Life Cyclehttp://developer.android.com/reference/android/app/Activity.html
Basic Components
Layouts
• FrameLayout
• Gallery
• GridView
• LinearLayout
• ListView
• RelativeLayout
• ScrollView
• Spinner
• SurfaceView
• TabHost
• TableLayout
• ViewFlipper
• ViewSwitcher
Create Your First
Android App
Get Started – Create Project with
eclipse
• Follow instructions @– http://developer.android.com/training/basics/firstapp/creating-
project.html
• Build SDK is the platform version against which you
will compile your app. By default, this is set to the
latest version of Android available in your SDK.
• Minimum Required SDK is the lowest version of
Android that your app supports
Running on the fly
Emulator
Run on a Real Devicehttp://developer.android.com/training/basics/firstapp/running-app.html
Setting Real Android Device
Connectionhttp://developer.android.com/tools/extras/oem-usb.html#Drivers
Capturing Screen from Real Devicehttp://www.butterscotch.com/tutorial/How-To-Display-Your-Android-Screen-On-Your-Desktop
Live from ARC :P
Live from ARC :P
activity_main.xml<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
XML Namespace - xmlnshttp://www.w3.org/TR/REC-xml-names/
Adding your first button
Designer VS Code
Adding your first button
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="18dp"
android:text=“Button" />
Adding your first button
• res > values > strings
• Add toggle_message to strings
• And in the activity_main.xml file<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="18dp"
android:text="@string/toggle_message" />
Events
• activity_main.xml file<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="18dp"
android:text="@string/toggle_message“
android:onClick="toggleMessageOnClick" />
Events
• MainActivity.java filepublic void toggleMessageOnClick(View view) {
// Do something in response to button
TextView textView =
(TextView)findViewById(R.id.textView1);
textView.setText("Bonjour Monde!");
}
Congrats! Run and see!Project (HelloWorld) is attached in case u wanna look at it