Developing Your First Android Application with IntelliJ IDEA on Ubuntu

Developing Your First Android Application with IntelliJ IDEA on Ubuntu
Developing Your First Android Application with IntelliJ IDEA on Ubuntu
If you are a programmer or have just started learning programming and you are loving the Smart-phone technology, then you would definitely love Android Programming as Android is the Future of Mobile Technology. If you know Java than things will be lot easier to learn. Although people with knowledge of other Programming languages can also learn it easily. You just need to enjoy it, because Programming is Fun and to create something makes us feel great, no matter what it is and Android makes it more beautiful.

So lets start with developing a basic android application with IntelliJ IDEA  which is an official Android IDE. Most of the tutorials on Internet are about using the Eclipse IDE, but IDEA is better in terms of performance as Eclipse really slows down the system. But an IDE should not be a constraint for you for developing the application. So if you enjoy working on Eclipse, you keep going with it. But try to work on IDEA also, you can feel the difference.

Let start with developing our first application on Ubuntu, but before that we need to set up the environment for application development. Two basic platforms required for starting Android Application Development are:

1. Java SDK:       You can get it Here
2. Android SDK: You can get it Here

Follow the required installation instructions to get the system ready for Android Development. You can skip the Eclipse ADT plug-in part as we are Using a Different IDE. Once you are done with the Required platform setup, you need to install the IntelliJ IDEA IDE which you can get it Here. Since we are working on Ubuntu, you need to get the Linux version of the IDE. Download and Extract the requited gz file and then inside the bin folder, run the idea.sh file to start the application. You should see the page like this:

Click on Create New Project and the following should be displayed.


Click Next and you should see below Screen. Enter the Project Name as shown
 and Select Module Type as Android.

  

Click Next and you should see below screen and by default create Source directory radio button should be selected. Leave it as it is. You src directory will contain files related to the application source.


Click Next and you should see below screen or before that you could one more screen where the application will ask for JAVA SDK path. Select that path and after that you have to select path for the Android SDK path which you can see in the top in below screenshot.


You should be prompted to select the SDK path as shown below:


Also in the previous screen-shot you can see the option for selecting the Target device where you will run your application.  We will be using the Emulator to run our application. So we will create a Virtual Device to run the application. A Virtual device is same as Physical device and it will show us the behavior of the application on the physical device. Select Emulator and click on Prefer virtual Device selection box to create the Virtual Device. You should see screen like below:


Give your virtual device a name and target platform for which you are simulating the behavior. After adding the details Click Create AVD and then you can choose the created Virtual Device in the Emulator option and then click Finish. You just created your first Android Project. :). 

Under Project Explorer, you can see the Project just created. And Click under src directory, you could see that the package created has the activity file created automatically, which is the main file for your application. 


Click the Green arrow button on the top to run your application. The IDE will launch the virtual Device and will run your application and the output should look like below.



Your first Android Application is ready!!









Google Nexus 7: A Closer Look at Specifications

On Wednesday, 27-2012, Google launched its Nexus 7 Tablet giving market a new competition. And when a new product is launched they come with new specifications. Lets have a look what Nexus 7 has to offer and what exactly some of the specifications mean, which can help you to make a better choice before buying a tablet:


Price: - $199 for the 8GB model and $249 for the 16GB model which is quite competitive as compared to Kindle fire with price of $199 and Samsung Galaxy tab 2 with around $249 , gives Google Nexus a good edge in the tablet market.


Manufacturer: - Asus, and the Nexus 7 Tablet is using an Android-based tablet platform code named Kai. Nvidia designed the Kai platform for manufacturers to create a competitive tablet at consumer-friendly pricing.

·   SCREEN: 
§  7” 1280x800 HD display (216 ppi): Pixels per inch (PPI) or pixel density is a measurement of the resolution of devices.
§   Back-lit IPS display:  In-Plane Switching (IPS) is an LCD technology, developed to correct the poor viewing angles and color problems that LCDs had. Other LCD technologies tend to have narrower viewing angles, especially in the vertical direction.
§  Scratch-resistant Corning glass:  At 0.1 millimeters thin, Corning’s brand new Willow glass is as thin as the finest human hair -- and will makes those smartphone sandwiches as much as 7 times thinner.
§  1.2MP front-facing camera

WEIGHT: 
§  340 grams

MEMORY:
§  8 or 16 GB internal storage
§  1 GB RAM

·    BATTERY:
§  4325 mAh (Up to 8 hours of active use): An ampere-houris a unit of electric charge, with sub-units milliampere-hour (mAh) and milliampere second(mAs). One ampere-hour is equal to 3600 coulombs (ampere-seconds), the electric charge transferred by a steady current of one ampere for one hour

CPU:
§  Quad-core Tegra 3 processor: Tegra is a system on a chip (SoC) series developed by Nvidia for mobile devices such as smartphones, personal digital assistants, and mobile Internet devices. The Tegra 3 includes a fifth "companion" core. The companion core is manufactured with a special low power silicon process that uses less power at low clock rate but does not scale well to high clock rates; hence it is limited to 500 MHz. The goal is for a tablet to be able to power down all the normal cores and run on only the companion core, using comparatively little power, during standby mode or when otherwise underutilizing the CPU.

SIZE:
§  198.5 x 120 x 10.45mm

WIRELESS:
§  WiFi 802.11 b/g/n
§  Bluetooth

·    USB:
§  Micro USB

OS:
§  Android 4.1 (Jelly Bean) 

FEATURES:
§  Microphone
§  NFC (Android Beam):  Beam is a capability that enables just about any type of proximity-based interaction. It means you just touch your smartphone to another smartphone or tablet to transfer files, Web site links, YouTube videos, links to apps, maps and directions -- or just about anything else you can think of. In order to engage Beam, you need a phone with near field communication (NFC) capabilities.
§  Accelerometer:  To calculate our device's orientation
§  GPS
§  Magnetometer: Embedded in mobile devices to permit touchless 3D interaction. Their interaction framework, tracks changes to the magnetic field around a cellphone to identify different gestures made by a hand holding or wearing a magnet.
§  Gyroscope: A device for measuring or maintaining orientation, based on the principles of angular momentum.


I hope, the specifications description will be of some advantage to you.





Kill Android SDK Manager Process in Linux

Android SDK Manager is required to download the tools for the Android Application development. And its been observe that it gets hanged and even if you try to close it from GUI , you won't be able to close it. Doing the CTRL+ALT+DEL can come to the rescue but in virtual machine its not the solution. The best way for such situations is to kill the process.


And you just need to type:  kill <process id>
To know the 'Process Id', we need to know the processes which are currently running and for that we type:
                                                   ps -e

To see more details of the processes, we can use another command:
                                   ps -aux | more
Now we need to know the process id of the android sdk manager and to know that, you need to type:
                               ps -aux | grep 'android'
And it will give you the complete output which would look something like this:
pc 2424 0.4 2.6 469844 54700 ? Sl Jun16 2:52 java -Xmx256M - Dcom.android.sdkmanager.toolsdir=/home/pc/Documents/android-sdk-linux/tools -cla sspath /home/pc/Documents/android-sdk-linux/tools/lib/sdkmanager.jar:/home/pc/Do cuments/android-sdk-linux/tools/lib/swtmenubar.jar:/home/pc/Documents/android-sd k-linux/tools/lib/x86/swt.jar com.android.sdkmanager.Main root 3290 0.0 0.0 0 0 ? S 09:41 0:01 [kworker/0:3]
So here you can see the process id which is: 2424.
Note: If you try to find the process is using:
                                        ps -e | grep 'android'
You won't be able to see the output because the ps -e command doesn't have the full name.But to find the process with this command you need to type:
                                   ps -e | grep 'java'
It will give the same process id which is same as the process id returned by running the command: ps -aux | grep 'android'. So just verify the id for both processes for confirmation and go ahead..


Now, to kill the process, type in Terminal:
                                     kill 2424
If it doesn't kill the process as it might be used somewhere or by another resource, we need to kill it forcefully. So in that case we type:
                                   kill -9 2424
And we are good to go. Please change the process id as it will be different for your case. And Bingo, the process is gone. You can do the same for other processes also which are bothering you and are not going away.
Hope it helps.