How to create an Android application
Install Java JDK and Eclipse.
Then open eclipse tool Go to MenuàWindowàPreferencesà
In that Page select Android and then choose Your Android SDK
location which you have downloaded.
Now let us create an app.
Choose your icon and click next
Then click next and then finish.
This is the main screen of your application.
Structure of your application.
The xml file which display a view to your app
Now i am designing simple login screen
Just drag and drop the component you needed from the left side of your layout(xml file).
This is the xml code that will generate automatically when you design it by drag and drop. you can edit this as per your need..
Now in Class file, Action listener for Activity as given below and import library as shown..
Create a new class in the Eclipse IDE from File ⇒ Class and fill all required details. I named this activity as HomeActivity.java
Now open manifest file in your application. It describes information about your application.
Now add your activity (class file which you created additionally) in manifest as shown
Now we have to check output so have to create emulator(android device for testing).
Go to window select Android Virtual Device Manager
Choose create new AVD(Android Virtual device)
Fill the require details as shown and click ok
Now choose start option to start your emulator
Emulator look like a real android device so that developer can check the output.
Now to check output your application
Select your app and right click it and choose run as.
In that select android application and click ok
The output of your app will be like this
Go to MenuàFile àNew àAndroid Application Project
Next Window will be like this.
Now enter your Application Name, Project
Name and Package Name.
Note: Package should be minimum two levels
in android.
Example: com.sample or com.sample.test
and click next.
Now select create custom icon, create activity and create project in workspace and then click next.
Choose your icon and click next
Then click next and then finish.
Structure of your application.
The xml file which display a view to your app
Now i am designing simple login screen
Just drag and drop the component you needed from the left side of your layout(xml file).
This is the xml code that will generate automatically when you design it by drag and drop. you can edit this as per your need..
Now in Class file, Action listener for Activity as given below and import library as shown..
Create a new class in the Eclipse IDE from File ⇒ Class and fill all required details. I named this activity as HomeActivity.java
Create a new class in the Eclipse IDE from File ⇒ Android xml file and fill all required details.
Now add your activity (class file which you created additionally) in manifest as shown
Now we have to check output so have to create emulator(android device for testing).
Go to window select Android Virtual Device Manager
Choose create new AVD(Android Virtual device)
Fill the require details as shown and click ok
Now choose start option to start your emulator
Emulator look like a real android device so that developer can check the output.
Now to check output your application
Select your app and right click it and choose run as.
In that select android application and click ok
The output of your app will be like this
Thank you.
Download code here
0 comments: