Skip to main content

Posts

Showing posts with the label Android-Java

Android - The radio group creation and event handler mechanism

 This is very simple example for creating check box in android application. Here I have created the new android project and I have modified the main.xml file with following code.  Here I have created the one radio grop and I have added some games names as option. Now I am going to display the selected game with using TextView. For getting this effect I have modified the main activity java file with following code. import android.app.Activity; import android.os.Bundle; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TextView; public class RadioBoxActivity extends Activity implements OnCheckedChangeListener{ /** Called when the activity is first created. */ RadioGroup radioGroup; TextView textView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(...

Android - The check box creation and event handler mechanism

 This is simple example for creating check box in android application. I have created the new android project and I have modified the main.xml file present in the layout folder with following code.  Here I have just drag and drooped the check box control and I have changed the text value as "The Checkbox is unchecked". Now I am going to add the on change listener for this check box. I have changed the main java file and this is my code. import android.app.Activity; import android.os.Bundle; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; public class BasicInputsActivity extends Activity implements OnCheckedChangeListener{ /** Called when the activity is first created. */ CheckBox checkBox1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); checkBox1 = (...

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...

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.