Showing posts with label Android Development. Show all posts
Showing posts with label Android Development. Show all posts

Saturday, October 24, 2015

Developing HTML in Android using Terminal IDE

Using Terminal IDE
In Android systems, Terminal IDE is installed through Google’s play store. After installation, when you launch the application, there are 6 button; Terminal IDE, Keyboard, Install System, options, shutdown and Help. First get acquitted with the help system. Most of the information you need you will find it here. I recommend reading the vim section since you will be spending much time in the vim editor and being acquitted with vim commands is essential.
STEP 1: Click on Terminal IDE
When you click on the Terminal IDE button, you will see a console or the terminal, which will look likes, the below:

Terminal++@105.54.187:~$

By default, terminal IDE comes with 4 terminals. These can be accessed by swiping through the windows. You will notice a black pop-up showing the terminal you are on, one through four.
Step 2: Creating and running HTML
(a)    Creating the directory
Swipe to terminal 1. After the dollar sign ($), type:

$cd ~/sdcard/

It will simply change from the current directory to the sdcard storage. cd is a command to change the working directory. Next, we create a folder where you will store you html code:

$mkdir /progs/
$cd ~/sdcard/progs/

mkdir is a make directory command. In this case, it creates a folder in your sdcard called progs. cd changes the working directory to progs. Make sure that at this point you are using Terminal IDE’s Keyboard. If not, click the back key, select the Keyboard, and set it to Terminal IDE. To go back simply hit the Terminal IDE button. If the keyboard does not appear in the terminal, tap the screen, it should appear. Your terminal should show as below:

:~/sdcard/progs$

This is your working directory. You can get the full path of the directory by typing:

$pwd

pwd is a simple Linux command to print the working directory.
(b)   Creating the files
The next part is to create 3 files: index.html, style.css, and script.js. To achieve this, we begin with the first file by typing the following command on terminal after the dollar sign ($):

$vim index.html

After you press enter, the screen should clear and you should see the vim editor. Press I key (as in India). The status bar at the bottom should now displays (-- INSERT --) in yellow, if not try going through the steps again.
 Now you are ready to type your html code. Type the code as below:

<!DOCTYPE html>
<html lang=en>
<head>
<link href=”style.css” rel=”stylesheet” >
</head>
<title>Test page</title>
<body>
<h1>This is a simple page</h1>
<script src=”script.js” type=”text/javascript”></script>
</body>
</html>

To save click on the escape button (ESC), then press the colon key (:) then w key, and q key and press enter.
To type the CSS code, on the terminal type:

$vim style.css

It will open a blank file in vim. press I key (the status bar should now show ---INSERT). Type the code below:

body {
                background-color:blue;
}

To save click on the escape button (ESC), then press the colon key (:) then w key, and q key and press enter.
Now we write the final file, on the terminal, type:

$vim script.js

On the vim editor, type:

Function myFunction () {
alert(“Javascript is working”);
}
myFunction();

(c)    Running on a browser
To run the html on a browser, open Google chrome. On the navigation bar, type:

file://sdcard/sdcard/index.html

You should see the output displayed on the browser window.

The above is just a simple version, you can create more complex code with Terminal IDE.

Friday, October 23, 2015

Programming ANDROID, JAVA, HTML, CSS, JAVASCRIPT, C and C++ in Android with terminal IDE



The introduction of smartphone has revolutionized everything, with every passing day people are relying more and more on apps to organize their lives. The advantage to this is that there is diverse applications that will cater for your every need and if not the case, your needs can be catered with little customization. The other benefit of smartphones is their ability to back-up all you documents, setting, contacts, and application via cloud. Unlike earlier days when losing a phone meant starting from scratch searching for contacts, and downloading application, nowadays, it is much simpler. If you accidentally lose your phone, in case of an Android phone, all your data will be restored as per your original phone thanks to dynamic cloud storage.
I favor android over all the other phone operating systems. The main reason being that Android is open source unlike its counterpart windows and Apple iPhone and iPad operating systems. You can download the source code, tweak it to your preference, and have your personal customized Android OS. There is also the ability get the latest Android release by building Android from source (“The Android Source Code”, 2015).
Since Android is a fully featured OS, it would be incomplete without the inclusion of developer tools. Google app store has hundreds of integrated developing environment (IDE) applications. Most of these apps are for purchase, but also come with free versions that have limited capabilities. For example, most of the free developer apps do not provide the save feature, or do not provide code highlighting features. If one needs these features enabled, they must pay a certain fee.  

TERMINAL IDE
Terminal IDE is an IDE that runs on terminal. Spartacus Rex develops it and according to their website; Terminal IDE is a fully featured java and android development environment. According to Chris Duckett 2012, Terminal IDE is a developer version of the Swiss army knife. As a developing environment, you will notice that Terminal IDE surpasses you normal IDE. It comes integrated with fully collection set of different language support. You can create website in HTML, CSS, and JAVASCRIPT and test it directly with your phone browser. Also you can develop java, Android and C application with minimal difficulties. Terminal IDE also partly supports C++, but your code is unlikely to break apart from large projects.
The downside to Terminal IDE is that it lacks advanced features that one would expect in a normal IDE. Functionality like code highlighting, auto completion, and intelisense features are not included. The IDE runs on terminal, code writing is done by VIM editor, a Linux based editor. Terminal IDE is not designed for people new to programming. Beginners can find the app a little challenging; though Terminal IDE Help section will get you going.


BENEFITS
Terminal IDE comes with command line tools like nano, vim, gcc, javac among others for development. Nano and vim are for editing source code while gcc and javac are for compiling written source code.
Terminal IDE can both be used offline and online thanks to Git, a version control system. The integration of Git in your projects will enable you to download, share, create, branch, and destroy repositories, locally or online over GitHub. 
Terminal IDE comes with its own full keyboard, optimized for programming. The keyboard is accessed by going to android phone setting, language and input under keyboard and input methods. The option of adding external keyboard using Bluetooth is also possible. 

Disadvantages
Terminal IDE runs on user instance, since each Android application gets its own group and user id. This may result in some restrictions and limitations (“GarageLab, 2013).

References
The Android Source Code. (2015, October 23). Retrieved from https://source.android.com/source/initializing.html
Duckett, C. (2012). Programming for Android on Android. Retrieved from http://www.techrepublic.com/blog/australian-technology/programming-for-android-on-android/
GarageLab. (2013). Development Environment for Android. Retrieved from http://thegaragelab.com/development-environment-for-android/