0% found this document useful (0 votes)
10 views5 pages

Mad Assignment

The document outlines the components of user interface (UI) design, including elements like EditText, TextView, and various layout types. It explains fundamental UI design principles, such as Views, View Groups, Fragments, and Activities, detailing their roles in creating interactive applications. Additionally, it provides a sample program for a rectangular progress bar and describes the main components of an Android application, including Activities, Services, Broadcast Receivers, and Content Providers.

Uploaded by

nkumbhare566
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Mad Assignment

The document outlines the components of user interface (UI) design, including elements like EditText, TextView, and various layout types. It explains fundamental UI design principles, such as Views, View Groups, Fragments, and Activities, detailing their roles in creating interactive applications. Additionally, it provides a sample program for a rectangular progress bar and describes the main components of an Android application, including Activities, Services, Broadcast Receivers, and Content Providers.

Uploaded by

nkumbhare566
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
1. Enlist the elements/components of UI. 2. Explain the fundamental of UI design in details. 3. Write a program to display a rectangular progress bar. 4. Describe Components of screen. Class: 3"! Year | Semester: 6" ‘Name Of Facult Prof. SM, Nagrale Unit 3:UI Components and Layout (CO3) C]. Develop rich user Interfaces by using layouts and controls. Que.1 Enlist the elements/components of UI 2M Ans. Elements of Ul. sEditText *TextView ListView * GridView *ScrollView *imageView © ToggleButton * CheckBox RadioButton ‘OR Components of UI Menu Bar * Toolbar Navigation Bar * Editor Tabs * Editor Project Explorer Status Bar * Tool Buttons Que.2 Explain the fundamental of UI design in details. am Ans. 1. Views: + The basic building block for user interface in Android is a View, which is created from the View class and occupies a rectangular area on the screen and is responsible for drawing and event handling. + Views are the base class for all visual interface elements (commonly known as ‘controls or widgets). All user interface UI controls, including the layout classes, are derived from View. + A View is an object/widget that draws something on the sreen by the help of user interact. + Examples of widgets are buttons, text boxes, labels etc. 2. View Groups: + The ViewGroup is a subclass of View and provides invisible container that hold other Views or other ViewGroups and define their layout properties. + View groups are extensions of the View class that can contain multiple child ‘Views, In order to Extend the ViewGroup class to create compound controls made up of interconnected child views. + A ViewGroup provides the layout in which we can order the appearance and sequence of views. Examples of ViewGroup are Frmaelayout, LineourLayout ete. 3. Fragments: + Fragments represents a portion of user interface in an Activity. Fragments, introduced in Android 3.0 which uses API level 11, are used to encapsulate portions of your UL. This encapsulation makes fragments particularly useful when ‘optimizing our Ul layouts for different screen sizes and creating reusable user interface (UI) elements. + Each Fragment includes its own user interface (Ul) layout and receives the related input events but is tightly bound to the activity into which each must be embedded. Fragments are similar to UI view controller in iPhone development. 4. Act o * Activities dictate the UI and handle the user interaction to the smart phone screen. Activities represent a single screen that user interact. + Activities are the Android equivalent of Forms in traditional windows desktop development. To display a UI we assign a View (Usually a layout or Fragment) to an Activity. Que.3 Write a program to display a rectangular progress bar. 4m Ans. ‘Xml File: Java file: package in.edu.vpt.progressbar; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android. widget. ProgressBar; import android. widget.TextView; public class MainActivity extends AppCompatActivity { private ProgressBar progressBar; private int progressStatus = 0; private Text View textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progressBar = (ProgressBar) find ViewByld(R id progressBar); textView = (TextView) findViewByld(R.id.textView); // Start long running operation in a background thread new Thread(new Runnable() { public void run() { while (progressStatus < 100) { progressStatus += 1; new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { progressBar.setProgress(progressStatus); text View.set ext(progressS tatus+"/"+progressBar.getMax()); } vi uy // Sleep for 200 milliseconds. Thread.sleep(200); } catch (InterruptedException e) { eprintStackTrace(); + + } })start()s } + Que.4 Describe Components of screen. am Ans. ‘Components are the essential building blocks of an Android application. The description of each component and how they interact with each other can be found in the file AndroidManifest.xml ‘The four main components that can be used with Android Application includes: 1. Activity 2. Services 3. Broadcast receivers 4, Content Provider 1. Activity ‘Its said to be the entry point for interaction with user. «It is a class that allows loading the user interface for your application and visualizing the layouts. An activity provides the window in which the app draws its UL. Generally, one activity implements one screen in an app. ‘© Most of the apps have multiple screens meaning that they contain multiple activities. * One of the activities in the app is specified as the main activity and itis the first one to appear on the screen when user launches the app. You implement activity as a subclass of Activity class. E. g: Inan email-application, composing of email can be one activity screen. 2. Services * It is used for performing background long running operations for applications or to perform work for remote processes. It does not provide any user interface. * For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity. The service can be either predefined or user defined. A service is implemented as a subclass of Service 3. Broadcast receivers ‘© These are the classes used to broadcast events of an application to another application. This allows the app to respond to system wide broadcast announcements. The broadcasts can be delivered to the apps even when they are not running. * Apps can also generate the broadcasts for example to let other apps know that the data has been downloaded to device etc. Broadcast receivers do not display any user interface but they may create status bar notification to alert the user when broadcast event occurs. # A broadcast receiver is implemented as a subclass of Broadcast Receiver and each broadcast is delive red as an Intent object. 4. Content Provider «It is a means of accessing the data ‘It manages shared set of app data that can be stored in file systenvin a SQLite database’ on the web / on any other persistent storage location that the app can access. Through the content provider, other apps can query or modify the data if the content provider allows it.

You might also like