Welcome to Android application development … START
Welcome to Android application development …
START
Create a Project with Eclipse
1
In the window that appears, open the Android folder, select Android Application Project, and click Next.2
Click New in the toolbar
skip
3
Here we go…
Now we will fill the form that appears.
Application Name is the app name that appears to users.
For this project, use “myaap"
Project Name is the name of your project directory and the name visible in Eclipse.
skip
3
Here we go…
Now we will fill the form that appears.
Package Name is the package namespace for your app.
Your package name must be unique across all packages installed on the Android system.
For this project, you can use something like "com.example.myaap"
skip
3
Here we go…
Now we will fill the form that appears.
Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API LEVEL.
To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set.
Target SDK indicates the highest version of Android (also using the API LEVEL) with which you have tested with your application.
skip
3
Here we go…
Now we will fill the form that appears.
Compile With 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.
You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
skip
3
Here we go…
Now we will fill the form that appears.
Theme specifies the Android UI style to apply for your app. You can leave this alone.
Click Next.
skip
4
Here we go…
On the next screen to configure the project, leave the default selections
and click Next.
skip
The next screen can help you create a launcher icon for your app.5
You can customize an icon in several ways
You can also add your own icon by selecting BROWSE button.
Then Click Next.
skip
6
Then Click Next.
Now you can select an activity template from which to begin building your app.
For this project, select BlankActivity.
skip
7 Leave all the details for the activity in their default state and click Finish.
skip
Your Android project is now set up with some default files and you’re ready to begin building the app.
Continue to the next lesson.
skip
HOW TO RUN YOUR APPLICATION?skip
Run Application on your Android Mobile Phone
Plug in your device with a USB cable.
Enable USB debugging on your device.On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.
On Android 4.0 and newer, it's in Settings > Developer options.
Now click Run from the toolbar
1
2
3
skip
In the Run as window that appears, select Android Application and click OK.
Run Application on your Android Mobile Phone
Steps 1
Click here to view bigger image
Click here to quit image
Select your
mobile then click OK
This type of screen you can see in your mobile phone.
(after Creating Project)
skip
HELLO WORLD
HELLO WORLD
we will create a project name HELLO WORLD.
skip
Create a project name My aap1.1 Refer “how to create project”
skip
After creating a project u can see this type of screen
skip
2
Now connecty o u r d e v i c e w i t h
Computerrun your application.
&
Refer “how to run application”
skip
Adding Button
Creating a Button
skip
1 On the left hand side you can see “Button ” option.
skip
2
button
Click the button and drag on the app window where you want to put.
Now the button is
created.
skip
EditButton Click here
B u tt o nTextskip
1
Double click
on the button orClick on “activity_main.xml”
skip
2 This type of window will appear.
Edit Code:
A n d r o i d : t e x t = “ Button” / >
A n d r o i d : t e x t = “ Click here” / >
skip
3 Click on “graphics Layout” and see the result.
skip
On Click Effect
skip
1 First create a butt on. Refer “adding button”
skip
2 C r e a t e a .XML File. New/android XML fileG o t o
skip
2 C r e a t e a .XML File. New/android XML fileG o t o
This window will appear.
Resource Type: It is a folder location where your new XML file will placed.
Project: Your current project name.
File: Give your file name
skip
2 C r e a t e a .XML File. New/android XML fileG o t o
This window will appear.
Project: Your current project name.
File: Give your file name
click
Now give File name
“Click”
Now Click “Finish”
Resource Type: It is a folder location where your new XML file will placed.
skip
Now your file is created in following location.
1 2 3 4
Folder Location
Go to Myaap > res > layout > click.xml
skip
Now double click on click.xml file.3
This type of window will appear Drag and drop “ LARGE ” text to your app window.
LARGELARGE
skip
Edit “ LARGE ” text and rewrite “ Making Project ”.4
Double click on the text and the following window will appear.
Edit text :
android:text=“large” to “making project”
skip
Now go to MainActivity.java5
& we will now write the code for
on click effect.
skip
setContentView() sets the layout for the Activity. It includes Buttons, TextViews, etc
Understanding the code.
R.layout.activity_main This is your layout,(actually this is location of the file where activity_main.xml file is situated,R= resource folder / layout folder / activity_main.xml)
findViewById(R.id.button1);It will find button1
@OverrideIt will reject the common errors and run your application.
public void onClick(View v) {setContentView(R.layout.click);If user click on button then another page will appear ( click.xml ).
setContentView(R.layout.click);this will open the page located in (R.layout.click)
Following is the code for “on click action “.
skip
Click the green button and copy the code and paste it into your
mainactivity.java
skip
Finally Run your application in your
mobile or immulator.
skip
1
skip