Android Development Questions & Answers
1. Four attributes of:
1. *ToggleButton*:
- android:textOn
- android:textOff
- android:checked
- android:disabledAlpha
2. *JRadioButton*:
- android:text
- android:checked
- android:button
- android:gravity
3. *Button*:
- android:text
- android:textSize
- android:textColor
- android:background
4. *EditText*:
- android:text
- android:hint
- android:inputType
- android:maxLength
5. *LinearLayout*:
- android:orientation
- android:layout_width
- android:layout_height
- android:gravity
2. Two classes used for playing audio and video:
• MediaPlayer
• VideoView
3. Uses of intents in Android:
• To start an activity (screen navigation)
• To pass data between activities
• To start a service
• To broadcast messages
4. Use of content providers:
• To share data between applications
• To access data from databases, files, or the internet
5. Difference between started service and bound service:
6. Different types of sensors in Android:
• Motion Sensors (Accelerometer, Gyroscope)
• Environmental Sensors (Temperature, Pressure)
• Position Sensors (Proximity, GPS)
7. Permissions required for Wi-Fi service in AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
8. Basic methods of AsyncTask:
• onPreExecute() – Runs before task starts
• doInBackground() – Executes the background task
• onProgressUpdate() – Updates UI during the task
• onPostExecute() – Runs after task completes
9. Working of content provider:
• Acts as a bridge to access data from databases, files, or the internet.
• Uses ContentResolver to query, insert, update, or delete data.
• Provides secure data sharing between apps.
10. Steps to connect SQLite database:
1. Create a SQLiteOpenHelper class
2. Override onCreate() to define tables
3. Use onUpgrade() to update schema
4. Open the database and perform queries
**Use of onCreate() and onUpgrade():**
• onCreate() – Creates database tables when the app is installed.
• onUpgrade() – Modifies tables when a new version of the app is installed.
11. Diagram of Activity Lifecycle:
(Refer to an Android activity lifecycle diagram.)
12. Two methods of DatePicker and TimePicker:
• DatePicker: getYear(), getMonth()
• TimePicker: getHour(), getMinute()
13. Types of queries in SQLite:
• DDL (Data Definition Language) – CREATE, ALTER, DROP
• DML (Data Manipulation Language) – INSERT, UPDATE, DELETE
• DQL (Data Query Language) – SELECT
14. Need for SQLite database:
• Stores data locally on the device
• Lightweight and fast
• No need for a separate database server
15. Android Service Life Cycle:
• onCreate() – Service starts
• onStartCommand() – Executes a task
• onBind() – Binds to components (only for bound service)
• onDestroy() – Stops service
(Refer to an Android service lifecycle diagram.)