Have you ever downloaded an app from the Play Store only to realize that you need features that are just missing in the app? Well, if you have the requisite skills, then this Techspirited article will show you how to write an app with AIDE, and that too on your phone itself.
Quick Tip
To write an app for Android, fair knowledge of JAVA and XML programming is a prerequisite.
Let’s start with the good news first. No more waiting for those huge environment files to download so that your PC can run the required software. By the time you have all the environment set up, you are so tired that the energy to write an app has just ebbed away. The result? Hours of time wasted with no output. Here’s a way to avoid all that cumbersome work, and start working on your app right away. You can say that Eclipse and Android SDK are now a thing of the past, but we’ll get to that later. First, let’s guide you through the process of writing your own app on the all-new AIDE.
To start with, you need to have an Android Phone or any Android app Player; I prefer the Bluestacks app player for PCs. If you are working on your phone itself, you will have to download and install AIDE, which is available from the Play Store. Alternatively, if you are working on your PC, then the aforementioned Bluestacks player needs to be installed on the PC. Once you are done with this step,
1. Open the app (AIDE on the phone, or Bluestacks on the PC)
2. A popup dialog box will appear. No need to panic, this is where you will name your app. Don’t worry about the information and other details there, all you have to do is to give your app a name. Remember that there are no spaces allowed in the name.
3. In this case, we have chosen the app name ‘FirstApp’. After you enter the desired name, press the Create button.
After you press the create button, give the program a little time to execute the command. If you are working on the phone, remember that it is performing the task of a desktop having Eclipse and SDK for Android running together. Basically, it is doing everything that your IDE would do on your computer.
4. After it has loaded, a white screen will appear with some text on it. This is your JAVA editor; type your algorithm-logic code here.
NOTE: You will also see a box that covers most of your screen. This is nothing but the file explorer. Pressing the computer icon present at the top right corner will toggle the explorer on or off.
NOTE: Tapping on the white screen will get you the keyboard. When you load the application, there is already some text that appears. This is your JAVA code.
When you are writing the code, most of it goes inside a bracket known as a class. You can read some of this code written as public Class MainActivity extends Activity. Here, it asks the Main Class to act as an Activity.
5. Search for setContentView(R.layout.main); and delete it.
When you want to display any text (a sentence or a number), you need to have it stored inside a variable (). Then the Class will tell Android that this variable should be displayed through a TextView (displaying class).
So, we write: TextView text;
NOTE: Do not forget the semi-colon at the end of the line. This basically informs the system that one command is over, and it can proceed to the next command.
6. Below, we will say this text will act as a new TextView for now. We need to use the following code:
text=new TextView(this);
Now, we need to tell the ‘text‘ to take some value and display it. So, we set text in double quotes (only if it’s alphabets and numbers).
Text.setText(“Your text goes here.”);
OR
text.setText(“Hello Android User!”);
NOTE: You can write anything as long as it stays within the quotes.
AIDE has an amazing feature known as Intellisense, also found in IDEs like Microsoft Visual Studio and Adobe Dreamweaver. Intellisense is basically an auto-complete feature that recognizes text or values as you start typing. Relevant entries are shown in a drop-down menu for you to choose the desired option.
So, now as you go in and type
setContentView,
A drop-down will appear, and you can tap on it. Inside the brackets, you need to key in the name of the variable that needs to be displayed.
Voila! You have an app ready to run.
Now, press Options ? Run
IDE will build your app(.apk) and execute it on your phone, and will then ask you to install it.
After installing, you will see what you had written within those double quotes, in Step 6.
That’s what I got, what did u get?
You can go ahead and type stuff, and run the application.
Now, after you are done with playing around with multiple apps, you might want to re-open the previous or another app, recalling the previous part where we toggled the explorer, you need to open that again,
and go the following path:
/mnt/sdcard/AppProject/”project name“/src/mycompany/myapp
Congratulations! Here’s your first app running. Keep programming and developing. Also, keep commenting and stay tuned for more!