A Beginner's Guide To Develop Android Apps Using Android AIDE
Android
is truly an alluring platform and there are reasons for that. The
platform opens up the possibility of new things for developers by
providing them diligent ways to develop and use applications. More and
more developers are attracted to the Android and thus creating apps
that are truly enthralling and engaging.
The
availability of a number of free tools and start-up kits has also
strengthened the process of custom application development. Now, would
be app makers have another robust tool called AIDE (Android Integrated
Design Environment) to develop feature-rich mobile apps using their
Android phone or tablet. The tool is an ideal pick for those developers
who are more inclined towards JavaScript.
Before
its inception, it was quite difficult for developers to set up an
environment for Android. In fact, more challenging was the process of
offline Android installation. For large scale applications, developers
still have the option to use Eclipse SDK, on a PC. But, for small, AIDE
is the only handy choice. Using IDE, Android developers can have a
reliable development package accompanied by an access to code
completion, formatting, editing, refactoring, and real-time code
checking. AIDE runs directly on Smartphones and other mobile devices. It
is also compatible with Eclipse IDE.
In this tutorial, I am going to discuss about the creating an exemplary Android app development using AIDE. The guide is easy to follow and will surely help you in your first Android app project.
Preparing the Ground
Install AIDE from Google Play on your Android device
AIDE comes integrated with a mobile version of the Android SDK, so you don't need to install anything else
Getting Started with the App Project
Opening
the AIDE on your device, you'll be first provided with a screen
prompting you to provide the package name and location of your app. Make
sure that whatever the name you may choose, it should be unique across
all the installed packages.
Once
you are done filling the details, click on the “Create” button.
Selecting the button will take you to a screen which displays all the
related files accompanied by the source code you need to use for your
project. AIDE will create all these files in your SD card. In addition,
it will also provide you with two most important files for editing
purposes. The files are: main.xml and MainActivity.java.
By
default a Git Repository will also be created by AIDE for your new
project. You can turn off this feature in the settings. Please read the
given tutorial to know more about it.
Run the App
The next step is to compile your app using the Run command from the menu just like this:
To
make your app run, AIDE automatically creates an Android Application
Package File (APK) for your app. Android APK is basically a file format
used to install apps and softwares for Android. It features all your
program's code, assets, certificates, resources, and more. An
installation dialogue box is provided to the user to know about the
process.
The following screen will be displayed to the user, if the compilation was successful.
Once the installation is complete, you can see your app listed among all the apps. Just like this:
Just click on the app, and you'll see the result like this:
Let's Play Around the Code
As
of know we have successfully compiled and installed our app, the next
step is create an interface for our application. The Android SDK
provides an XML file format that helps you define the UI for your app.
For
this use the below mentioned code in your res/layout/main.xml file. The
code will help you determine the interface of your app.
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your name: " />
android:id="@+id/txtName" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnOk" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK" />
Using
the code above, you'll be provided with a linear layout with a vertical
orientation. The layout features 'TextView' to display the static
information. The 'EditText' allows you to accept the input from the
user, whereas OK and Cancel buttons are used to process or clear the
EditView comments.
When
you create “Hello World” app, AIDE automatically opens the main.xml
file which allows you to determine the main activity of your app. Use
the following code should be used with your src/com/MainActivity.java to
define your application Activity.
package com.azim;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.app.AlertDialog.Builder;
public class MainActivity extends Activity implements View.OnClickListener
{
EditText txtName;
Button btnOk,btnCancel;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/* Referencing controls */
txtName=(EditText)findViewById(R.id.txtName);
btnOk=(Button)findViewById(R.id.btnOk);
btnCancel=(Button)findViewById(R.id.btnCancel);
/* Registering the onClick event of the buttons */
btnOk.setOnClickListener(this);
btnCancel.setOnClickListener(this);
}
public void onClick(View view)
{
if(view==btnOk)
{
/* Display Welcome message */
Builder builder=new Builder(this);
builder.setTitle("Welcome to Android");
builder.setMessage("Hello "+txtName.getText()+"!!!");
builder.setCancelable(true);
builder.show();
}
if(view==btnCancel)
{
/* Clear the EditText */
txtName.setText("");
txtName.requestFocus();
}
}
}
That's all! You can now go on to create buttons and responses for your app to make it function well.
To Wrap Up
AIDE
is a perfect pick for those who want to create a robust Android
application on their device quickly and easily. Those who are getting
into Android app development should consider it as a platform for their
future endeavors.
Post A Comment:
0 comments:
Post a Comment