As you are done with the initial setup and the installation of the softwares to build your own android apps. now, we'll start building the basic and the first app.
now change the main.xml file to the below code as shown.
the configuration to run your android application is given below.
The Eclipse plugin makes it easy to run your applications:
so, i guess you executed your first android application.
any further problems, pls write down your problems in the comments.
keep following for more android applications and solutions.
Create a New Android Project
After you've created an AVD you can move to the next step and start a new Android project in Eclipse.- In Eclipse, select File > New > Project....
If the ADT
Plugin for Eclipse has been successfully installed, the resulting dialog
should have a folder labeled "Android" which should contain
"Android Project". (After you create one or more Android projects, an entry for
"Android XML File" will also be available.)
- Select "Android Project" and click Next.
- Fill in the project details with the following values:
- Project name: HelloAndroid
- Build Target: Select a platform version that is equal to or lower than the target you chose for your AVD.
- Application name: Hello, Android
- Package name: com.example.helloandroid (or your own private namespace)
- Create Activity: HelloAndroid
Here is a description of each field:
Project Name
- This is the Eclipse project name — the name of the directory that contains the project files.
- Application Name
- This is the human-readable title for your application — the name that appears on the Android device.
- Package Name
- This is the package namespace (following the same rules as for packages in the Java programming language) that you want all your source code to reside under. This also sets the package name under which the stub Activity is generated. Your package name must be unique across all packages installed on the Android system; for this reason, it's important to use a standard domain-style package for your applications. The example above uses the "com.example" namespace, which is a namespace reserved for example documentation — when you develop your own applications, you should use a namespace that's appropriate to your organization or entity.
- Create Activity
- This is the name for the class stub that is generated by the plugin.
This is a subclass of Android's
Activityclass. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an Activity is almost always used as the basis for an application.
HelloAndroid.java file, located inside HelloAndroid > src >
com.example.helloandroid). It should look this : i.e copy and past the below code in the HelloAndroid.java file.package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } }
now change the main.xml file to the below code as shown.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
now you are good to run your first android application.the configuration to run your android application is given below.
The Eclipse plugin makes it easy to run your applications:
- Select Run > Run.
- Select "Android Application".
so, i guess you executed your first android application.
any further problems, pls write down your problems in the comments.
keep following for more android applications and solutions.

No comments:
Post a Comment