Android: HelloWorld App

bluntmoaningΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

93 εμφανίσεις

CI T 49900

SENI OR PROJECT

BY: RYAN SEYMOUR

Android: HelloWorld

App

Android HelloWorld
App:

Creating the Project


In this power point you will develop your first
Android application for a tablet.


You will set up a Android project.


View the programming environment .


Add the code for a text box and button.


Run the emulator to view your HelloWorld app.



Android HelloWorld
App:

Creating the Project


Open Eclipse then select File
-
>New
-
> Project


Android HelloWorld
App:

Creating the Project


In the New Project Window select the folder Android
then the Android Project.


Android HelloWorld
App:

Creating the Project


Name the Project HelloWorld the select Next.


Android HelloWorld
App:

Creating the Project


Check the SDK target of Android 3.0 for this
example. (Example was build w/Android 3.0 so to
avoid conflicting errors this SDK will be used instead
of the latest one.)


Android HelloWorld
App:

Creating the Project


Name the package using recommended convention
of using your domain name in reverse order followed
by the project name. For example a domain of
johndoe.net would be converted as follows:

Supplied text: your.package.namespace

Means: extension.domain name .application name

Example: net.johndoe.HelloWorld



Android HelloWorld
App:

Creating the Project


Set the minimum SDK to 11 since for this example
and select Finish to create the HelloWorld Project.



Android HelloWorld
App:

Environment


First thing is to clean up your work environment by
closing unneeded windows.


Expand the HelloWorld folder in the Package
Explorer on the left side of the IDE.


Also take note in the top right corner you are viewing
the Java perspective.


Android HelloWorld
App:

Environment

Android HelloWorld
App:

Coding


Expand the res/layout folder inside the HelloWorld folder to
find main.xml. Open it by double clicking.


Add the following code before the end of the </
L
inearLayout>


<TextView


android:layout_width=
"
fill_parent“


android:layout_height=
"wrap_content"


android:text
=
"This is my first Android Application!" />




<
Button


android:layout_width=
"fill_parent"


android:layout_height
=
"wrap_content
"


android:text=
"And this is a clickable button" />

Android HelloWorld
App:

ViewGroups
/ Layouts


There are six different
V
iewGroups
/layouts that can
be used to setup the User Interface (UI). They are as
follows:
LinerarLayout, Absolute layout,
TableLayout, RelativeLayout, FrameLayout
, &
ScrollView



The LinearLayout is the one you will use the most
often during these PowerPoints.


When creating a project LinearLayout is the proper
way to code it, not linearlayout or linear layout.


A misspelled layout/file will crash the project.

Android HelloWorld
App:

Coding

Android HelloWorld
App:

Emulator


Save your project if you haven’t by pressing Ctrl+s.


To test your HelloWorld app select the project
name in the Package Explorer then press F11.


Select Android Application as the way to debug.


Android HelloWorld
App:

The Waiting


Again the waiting for the emulator to load…


Android HelloWorld
App:

The HelloWorld App


The HelloWorld App you just created. The button is
clickable but doesn’t do an logic yet.


Android HelloWorld
App:

The HelloWorld App


If you hit the tablets home button then the Apps icon
you will now see a icon for the HelloWorld app.


Android HelloWorld
App:

What to Turn In


Compress the HelloWorld folder where you defined
your workspace for Eclipse.


Android HelloWorld
App:

Conclusion


Congratulations, you created your first Android app.


You have modified the apps layout to include a
button and a text field.


From here you will modify this app for the next
assignment.