What are the available Views in Android Application with Full Code

Android views are nothing but the controls or we can say interacting components of the screen. As an example, we can say that textbox, button, checkbox, radio button etc are the various example of android views. In eclipse IDE, views are available as Android Widgets.

Following are some views in Android Application available using eclips IDE.

  • TextView
  • EditText
  • Button
  • CheckBox
  • RadioButton
  • Spinner

 

Reference to Views in Android application for Java Code

To get the reference to any view in java code, following code is used.

Java Syntax:
View   viewname = (View) findViewById (R.id.xmlid);

Where viewname is just like any variable name.
xmlid is id which we used in xml layout file.

XML Code:
<TextView android:id=“@+id/text1″/>

Java Code:
TextView myText = (TextView)findViewById(R.id.text1);

 

Message Box:

This is one kind of broadcast receiver available in android.Toast class is used to create message box in android.Toasts are Dialog boxes that remain visible for only a few seconds. Toasts don’t steal focus and are non-modal, so they don’t interrupt the active application. Toasts are perfect for informing your users of events without forcing them to open an Activity or read a Notification. They provide an ideal mechanism for alerting users to events occurring in background Services without interrupting foreground applications.

Java Syntax:

Toast(Cntext,String,Integer);


Eg.

Toast toast = Toast.makeText(context, msg, duration);
toast.show();

Context must be current application context.
Msg must be string variable which you want to show.
Duration must be the integer which indicate the time in millisecond.

Eg.Show message dialog WELCOME on android screen.

Toast.makeText(this, “WELCOME”,1000).show();


Full android web application Tutorial:-

Introduction How to develope Android application

What are the Fundamental Units of Android Application

Step by Step Installation guid for android application developent

How to Build and Run the Android Application

What are the available Views in Android Application with Full Code

Linear Layout in Android Application Development

Table Layout in Android Application

Relative Layout in Android Application

SQLite Database used in Android Application Development

Music Player Code for Android Application Development

How to make Phone call for Android Application with full code

Status Bar in Android Application Development with Full Code

Leave A Reply

Your email address will not be published.