Improve your contact center performance. See how you can make a difference.
Watch Now
Engage and build your ICT audience with CIOL online advertising.
Know more
Through the Android documentation provided along with the SDK you can start up with a 'Hello World' kind of application. Here we would try to explore a little more of the SDK framework; about the layout of UIs and Views and Activities. To start developing the demo application, first create a new Android Project by selecting File > New > Project menu. On the New Android Project window name the project as DemoAndroid, fill the Properties values for Package name, Activity name and Application name as shown in the visual.
Upon clicking the Finish button, the Android plugin runs and the auto-generated code for the project DemoAndroid gets created. The DemoAndroidApp class will be extending Activity class. An Activity is a thing that interacts with the user and is responsible for a window being created on which the UI components are placed. There are two methods that each subclass of Activity would implement:
On the Android Project window, name the project and also complete the Properties frame by giving names to Package, Activity and Application entries
onCreate(Bundle) :- It initializes the activity and by method setContentView() it describes the layout resource that defines the User Interface (UI). The method findViewById() is used to retrieve the UI components in that UI with which you want to interact with programmatically.
onPause() :- You override this method when you are dealing with a user who is leaving your activity, and you have to commit all changes done by the user before he leaves the activity.
Along with the DemoAndroidApp class you will find R.java file. It is an index for all the resources defined in the file. You use this class in your source code as a sort of short-hand way to refer to resources you've included in your project. We know that the method setContentView() looks for a resource that defines the UI. This definition file is an XML file and can be found in res directory under the main project directory. With res directory you can see there are directories named layout, drawable and values. The layout directory holds the main.xml file, which will be our UI definition file for the project. Other two directories are: Drawable, which holds the resource definition for the UI components design scheme; and 'Colors while values,' that holds values for UI components, be it a color or a string.
<TextView id="@+id/label1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter your Name: -"/> <EditText id="@+id/editor" android:layout_width="fill_parent" android:layout_height="35dip" android:capitalize="sentences" android:layout_weight="1" > <requestFocus /> </EditText> . . . <Button id="@+id/back" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="Submit" />
<< PREVIOUS NEXT>>