Skip to main content

Posts

Showing posts from February, 2012

Android - The purpose of the main.xml file

  In Android development, developers have two options for developing UI.     1. Using Java, like swing development     2. Using main.xml  Advantage of using main.xml for UI creation     1. It allows developer to drag and drop controls like .net development.     2. Reduced large amount of time for UI creation and it does allow developer to concentrate only on business logic.     3. Developer can easily add action to components like button, check box, etc.., 

Android- Creating some basic input fields

  In this tutorial I am going to explain about the basic input field such a as edit field, password field, multiline edit field, email field, etc.., creation in android.   Create a one new Android project and open the main.xml file in Layout window. In palette window you can able to see varies type of input field.  Just drag and drop some components in to your main screen. Here I have created some basic input fields, see the below screen shot.   For your reference, I have included the source code of my main.xml file.       <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent"     android:orientation = "vertical" >     < TextView         android:id = "@+id/tex...

Debugging android development

  The DDMS (Dalvik Debug Monitor Service) perspective of ADT-Plug-in is the best way of debugging the android application. Open your eclipse as DDMS perspective through window -> Open perspective -> others and choose DDMS view.  Basically the DDMS features are divided into five major functional areas.    1. File management    2. Logging    3. Screen captures    4. Task management    5. Emulator interaction   File management:    You can able to see your android file systems through file explorer present in DDMS perspective. See the below screen shot.   View Log information:   You can able to your log information through “LogCat” view. The LogCat view displays the error, warring, debug related information. See the below screen shot.   The “android.util.Log” class has some useful methods for logging our custom messages.  See the following methods and corresponding p...

Comparing two java class objects using equals() method

  The equals() method present in Object class is used for comparing two objects are pointed out the same memory or not. See the below example. public class EqualsDemo { public static void main(String[] args) { EqualsDemo obj1 = new EqualsDemo(); EqualsDemo obj2 = new EqualsDemo();   // The obj3 just refer the obj1 memory EqualsDemo obj3 = obj1; if(obj1.equals(obj2)) { System.out.println("The object1 and object2 are equals"); } else{ System.out.println("The object1 and object2 are not equals"); } if(obj1.equals(obj3)) { System.out.println("The object1 and object3 are equals"); } else{ System.out.println("The object1 and object3 are not equals"); } } }  In this example I have created the two objects (obj1, obj2) for class EqualsDemo. The obj3 is just pointed out the obj1 memory. Finally I compared the object1 and object2 as well as object1 and object3. The result should be like this. ...

Creating Copy of the Existing Object in Java Using Clone Method

  In Java, The "Object" class is the root class for all java classes, It means by default all the java classes inherit the Object class. The Object class have some useful methods for performing operation on the class object like clone(), getClass(), equals(), toString(), wait(), etc..,   The clone() methods is used for creating copy of the existing object. It's means it allocated the new memory for object with values and methods present in which object you are going to copy. For performing this clone() operation you have to implement the Cloneable interface and you have to override the clone() method. See the below example. public class CloneDemo implements Cloneable { public int testValue; public CloneDemo(int value) { this.testValue = value; } //Override the clone() method  protected Object clone() { Object newObject = null; try{ newObject = super.clone(); } catch(CloneNotSupportedException e){ e.printStackTrace...

Android - Hello world application

  I assume you have configured your eclipse or STS for android application development. If you not configured then follow up my previous tutorial.    1. For creating new android project open your eclipse or STS and go to File - New then choose Others. Select Android Project option and click Next.      2. Choose your android target version. It's based on your requirement, here I have choose my android version as 2.1. and click Next.    3. Specify your Java package name, Choose your minimum SDK version as 7 and click Finish.    4. The final folder structure will be looks like this.     5. For running this application you have to configure your "Android Virtual Driver Manager" . This is one time process for entire application development. For configuring this one, Choose Window -- AVD Manager or Click AVD icons present in your eclipse or STS.       6. Click ...

Android application development tutorial for beginners

Objective       In this series I am going to explain about android application development using Java.      1. Configuring eclipse or STS for android development      2. Introduction about Android Operating System      3. Important components of Android      4. Android - Hello world application      5. Debugging android development      6.  Android- Creating some basic input fields      7.  Android - The purpose of the main.xml file     

Important Components of Android

  The android have lot of components, but the following component are very important and these components are  frequently used for application development. 1. Activity    The building block of the user interface is Activity. The activity is just like a Window or Dialog in windows application or swing based application. 2. Content Providers   The content providers provide a standard way for accessing data from storage such as contact details, messages, etc. The data normally shared by more than one application for better storage maintenance. 3. Intents (Notification Manager)   Intents are systems messages running around the inside of the device. It’s notifying about systems changes such as hardware changes as well as application state changes. Example, Battery level, Signal level etc.., 4. Services    Activity, Content providers, Intents are short lived and it can be shut down at any time. But the services are i...

Introduction about Android

   Android is a first open source mobile platform that offers developers to develop the rich mobile application using java. It’s allows developer to take the advantage of mobile hardware, access location information, background services and much more.    This application framework specially designed for meet the following requirements.        1. Reuse of components        2. To give full access to developers to reuse the API that are used by core application   Android operating systems based on Linux version 2.6. This takes care of security, memory management, and network stack. The Linux kernel act as an abstraction layer between the hardware and software.

Integrating vertical and horizontal carousel in SenchaTouch

   Create a new sencha touch application with necessary files and modify the app.js file using following code. If you want to know about application structure, then follow my older post. Ext.application({     name : 'carouselDemo' ,     requires : [ 'Ext.carousel.Carousel' ],     launch : function () {          var horizontalCarouselItems = [];          for ( var i=0;i<5;i++) {            var tempItems = [];            for ( var j=0;j<10;j++) {            tempItems.push({            html : "<h3> Screen number: (" + i + "," + j + ")     </h3>"       });     }     horizontalCarouselItems.push({          xtype : 'carousel' ,         ...

Horizontal and Vertical carousel creation using SenchaTouch2.0

1. Download the latest SenchTouch2.0 library from following location.           http://www.sencha.com/products/touch/download 2. Create a one new root folder and name it is “app”. 3. Create a “js” folder inside the “app” folder and copy the "sencha-touch-all.js" file from downloaded library and paste it into “js” folder. 4. Create a “css” folder inside the “app” folder and copy the “sencha-touch.css” file from downloaded library and paste it into “css” folder. 5. Create "app.js" file into inside the app folder and paste the following code. Ext.application({  name : 'HCarousel',  requires : ['Ext.carousel.Carousel'],  launch : function() {   Ext.Viewport.add({   xtype : 'carousel',   direction : ' horizontal ',   fullscreen : true,            items :  [{                  html : 'Panel 1', ...

Sencha development using eclipse - Basic setups and folder sturcture

 Sencha touch is a OOP java script library used for creating HTML5 based mobile application, that run on mobile like Android, iPhone and Blackberry and give native app-work experience (Just like a JQuery Mobile).  Use below link for downloading secha touch library.        http://www.sencha.com/products/touch/download Sencha development - Basic folder structure. 1. Create a new web project using eclipse or STS. 2. Inside the web content folder, create a new folder called as 'sencha'. 3. Extract the sench library and copy the entire resources folder into 'sencha' directory. 4. Copy the 'sencha-touch-all.js' from Sencha library and put it into 'sencha' directory too. 5. Inside the web content folder, create one more  folder called 'app'. Inside into this folder, you have create model, view, controller, store and profile folders. Here only you need to put all your sencha related  JavaScript  files. 6. Inside the web c...