際際滷

際際滷Share a Scribd company logo
Android Application Development
Workshop
Day 1
Eng.Borhan Otour
borhan.a.otour@gmail.com
Hello World , this is Android
Agenda
What we will cover today
The Android System and the Android SDK.
The eXtensible Markup language (XML).
Building and running our first Application. (project structure -
AVDs)
The Project structure.
The First touch(Basic User-App Interaction)
 Basic Interconnection.
Advanced Interconnection.
The Android System Architecture
The Android Market and Activations
By 2013 , there were
Android Device Activated.
SO THERE IS A LOT OF PEOPLE WHO NEEDS
APPS FROM YOU.
The eXtensible Markup Language (XML)
Sample: collage.xml
The XML - overview
<school >
- - - - - - -
</school>
 Every starting tag has an end tag
 The Tag may have a child tags
<hospital>
<doctor>
<patient ----> --- </patient>
<patient ----> --- </patient>
</doctor>
</hospital>
 The Tag may contain attribute
<student name=Borhan age=23 ></student>
Android Application Development
1. The Installation of the development environment
2. The main application component  The Activity.
3. The View System.
The Installation
What do you need to prepare the development environment?
1. The Android SDK
2. An editor to code your project or The Integrated
Development Environment (Eclipse IDE)
3. Connect the IDE and the SDK to begin developing for the
Android market  (Android developer tool ADT)
 ( SDK + Eclipse )* ADT = My Android Development Environment
 Remember:
SDK = Android development tools + Android application framework
Android Application development -
Activities
The activity:
the most important Android application component.
Its a java class that represent a Screen.
Each application must contain one screen .
This is an Activity
Note: The activity is not a layout
Android Application development
(create a simple layout) .cont
The view:
The view is the fundamental component you see in the
screen that is used to build layouts.
The views can be containers or a widgets.
Android Application development
(create a simple layout) .cont
The layout is composed of a hierarchy of views
Building the first application
Hello World, Android
1. Setup the Android projects workspace.
2. Create a new Android application project.
3.Launch the Android Application Project.
4.What is the project structure?
Create a new Android app project
1. Together lets setup the workspace
2. Project creation step 1
Create a new Android app project
3. Project creation step 2
Create a new Android app project
4. Project creation step 3
Create a new Android app project
5. Project creation step 4
Create a new Android app project
6. Project creation step 5
Create a new Android app project
(The Android virtual device AVD)
The Android Virtual Device (The Emulator)
The project structure - res
The static content of any Android
application is called a resource.
1. images.
2. Textual content.
3. Layouts.
4. Etc 
The main idea to reach a resource is
that , each resource item must have
an ID.
To reach to a resource ID us in XML:
@resourceType/resourceID
Ex: @string/app_name
(in the AndroidManifest.xml)
The project structure  AndroidManifest.xml
The project structure  AndroidManifest.xml
To Set the layout content of an Activity use the:
setContentView(int layoutResouceID);
Basic call Back
Android Toast
1. Assign Id to view to get them in code.
2. Get Views in code to manipulate them.
3.Build a basic call back mechanism.
Basic callbacks : get Views In Code
The Goal:
We Assign an ID to a view element like Buttons, TextView
so we can reach them in code.
The Way:
we set an id to the view element like (TextView , Button)
Using android:id=@+id/idName
In the Activity we call the view:
Using the Activity function: findViewById(int viewId)
viewId = R.layout.some_layout_resource_name
Basic callbacks : (The R class)
XML
resource
Java CodeR.java
public final class R {
public static final class string{
/** String array of all countries in the world
public static final int app_name=0x7f060001;
public static final int hello=0x7f060000;
}
-----
}
The activity_main.xml file that represents the layout of the MainActivity.java
Basic Interconnection
Two Layout 粥沿沿鉛庄界温岳庄看稼
1. Adding a new Activity to the project.
Creare a new Activity
Crearte a new Activity
Crearte a new Activity
Start the new Activity
The Intent Object:
Intent intent = new Intent();
Put Some content in the message:
intent.putExtras(String key,Object vlaue);
Start The new Activity:
startActivity(intent);
Receive the intent object:
getIntent();
Advanced Interconnection
Get Application 粥沿沿鉛庄界温岳庄看稼
Interconnection between activities
(The Intent system)
Activity 2Activity 1
 When you want to launch a new Activity from the current Activity
you need to use Intents.
 The Intent represents the Application Intention to do something,
which is (launching a new Screen) .
 You specifies the current Activity and the name of the Destination
Activity in the construction of intent object.
Intent intent = new Intent(this , destinationActivityName.class)
 You can put extra content in the message that you send to launch a
new Activity.
Intent.putExtras( String key , value);
Interconnection between activities
(The Intent system) .cont
 To launch the new Activity from the current activity use the
Activity method:
startActivity(Intent intent)
 To get the Intent object that caused the activity to be launched:
In the destination Activity , use the activity method:
getIntent()
 To extract the extra data from the intent based of the type of data
( like String data for instance ) : intent.getStringExtras(String key)
References
http://developer.android.com/index.html
The API documentation
http://developer.android.com/reference/packages.html
 Building the first application
http://developer.android.com/training/basics/firstapp/index
.html

More Related Content

Android application development workshop day1

  • 1. Android Application Development Workshop Day 1 Eng.Borhan Otour borhan.a.otour@gmail.com
  • 2. Hello World , this is Android
  • 3. Agenda What we will cover today The Android System and the Android SDK. The eXtensible Markup language (XML). Building and running our first Application. (project structure - AVDs) The Project structure. The First touch(Basic User-App Interaction) Basic Interconnection. Advanced Interconnection.
  • 4. The Android System Architecture
  • 5. The Android Market and Activations By 2013 , there were Android Device Activated. SO THERE IS A LOT OF PEOPLE WHO NEEDS APPS FROM YOU.
  • 6. The eXtensible Markup Language (XML) Sample: collage.xml
  • 7. The XML - overview <school > - - - - - - - </school> Every starting tag has an end tag The Tag may have a child tags <hospital> <doctor> <patient ----> --- </patient> <patient ----> --- </patient> </doctor> </hospital> The Tag may contain attribute <student name=Borhan age=23 ></student>
  • 8. Android Application Development 1. The Installation of the development environment 2. The main application component The Activity. 3. The View System.
  • 9. The Installation What do you need to prepare the development environment? 1. The Android SDK 2. An editor to code your project or The Integrated Development Environment (Eclipse IDE) 3. Connect the IDE and the SDK to begin developing for the Android market (Android developer tool ADT) ( SDK + Eclipse )* ADT = My Android Development Environment Remember: SDK = Android development tools + Android application framework
  • 10. Android Application development - Activities The activity: the most important Android application component. Its a java class that represent a Screen. Each application must contain one screen . This is an Activity Note: The activity is not a layout
  • 11. Android Application development (create a simple layout) .cont The view: The view is the fundamental component you see in the screen that is used to build layouts. The views can be containers or a widgets.
  • 12. Android Application development (create a simple layout) .cont The layout is composed of a hierarchy of views
  • 13. Building the first application Hello World, Android 1. Setup the Android projects workspace. 2. Create a new Android application project. 3.Launch the Android Application Project. 4.What is the project structure?
  • 14. Create a new Android app project 1. Together lets setup the workspace 2. Project creation step 1
  • 15. Create a new Android app project 3. Project creation step 2
  • 16. Create a new Android app project 4. Project creation step 3
  • 17. Create a new Android app project 5. Project creation step 4
  • 18. Create a new Android app project 6. Project creation step 5
  • 19. Create a new Android app project (The Android virtual device AVD) The Android Virtual Device (The Emulator)
  • 20. The project structure - res The static content of any Android application is called a resource. 1. images. 2. Textual content. 3. Layouts. 4. Etc The main idea to reach a resource is that , each resource item must have an ID. To reach to a resource ID us in XML: @resourceType/resourceID Ex: @string/app_name (in the AndroidManifest.xml)
  • 21. The project structure AndroidManifest.xml
  • 22. The project structure AndroidManifest.xml To Set the layout content of an Activity use the: setContentView(int layoutResouceID);
  • 23. Basic call Back Android Toast 1. Assign Id to view to get them in code. 2. Get Views in code to manipulate them. 3.Build a basic call back mechanism.
  • 24. Basic callbacks : get Views In Code The Goal: We Assign an ID to a view element like Buttons, TextView so we can reach them in code. The Way: we set an id to the view element like (TextView , Button) Using android:id=@+id/idName In the Activity we call the view: Using the Activity function: findViewById(int viewId) viewId = R.layout.some_layout_resource_name
  • 25. Basic callbacks : (The R class) XML resource Java CodeR.java public final class R { public static final class string{ /** String array of all countries in the world public static final int app_name=0x7f060001; public static final int hello=0x7f060000; } ----- }
  • 26. The activity_main.xml file that represents the layout of the MainActivity.java
  • 27. Basic Interconnection Two Layout 粥沿沿鉛庄界温岳庄看稼 1. Adding a new Activity to the project.
  • 28. Creare a new Activity
  • 29. Crearte a new Activity
  • 30. Crearte a new Activity
  • 31. Start the new Activity The Intent Object: Intent intent = new Intent(); Put Some content in the message: intent.putExtras(String key,Object vlaue); Start The new Activity: startActivity(intent); Receive the intent object: getIntent();
  • 32. Advanced Interconnection Get Application 粥沿沿鉛庄界温岳庄看稼
  • 33. Interconnection between activities (The Intent system) Activity 2Activity 1 When you want to launch a new Activity from the current Activity you need to use Intents. The Intent represents the Application Intention to do something, which is (launching a new Screen) . You specifies the current Activity and the name of the Destination Activity in the construction of intent object. Intent intent = new Intent(this , destinationActivityName.class) You can put extra content in the message that you send to launch a new Activity. Intent.putExtras( String key , value);
  • 34. Interconnection between activities (The Intent system) .cont To launch the new Activity from the current activity use the Activity method: startActivity(Intent intent) To get the Intent object that caused the activity to be launched: In the destination Activity , use the activity method: getIntent() To extract the extra data from the intent based of the type of data ( like String data for instance ) : intent.getStringExtras(String key)
  • 35. References http://developer.android.com/index.html The API documentation http://developer.android.com/reference/packages.html Building the first application http://developer.android.com/training/basics/firstapp/index .html