2
2
3. Demonstrate the use of array adapter and spinner control with code.
4. Explain Sqlite database and design a form with Course name, Course description, course
duration fields.
5. Create Android application for addition of any two numerical digits.(XML file and Java file
3 What is the name of the folder that contains the R.java file?
6 Which of the following tools dumps system log messages including stack traces when the device or
emulator throws an error?
7 Which of the following methods updates a ListView when an element is added to the data set?
9 Which of the following methods is called in an Activity when another activity gets into the
foreground?
11
______Types of layouts in android.
A) 7 B) 6 C) 3 D) 2
12
Layout or design of an android application is saved in
13
_________ allows you to select an item from a drop down menu.
14
_________Types of Orientations in android.
A) 5 B) 2 C) 3 D) 4
15
The ________________ is a debugging tool used in the Android platform.
16
If the menu items are less than or equal to six, the menu is called an______
17
Which of the following methods is called in an Activity when another activity gets into the
foreground?
18
_________ shows the process completion status in android.
19
___________box is used for selecting a date by the user
A) DatePicker B) TimePicker C) Date class D) Calendar class
20
What is the name of the folder that contains the R.java file?
22. Manifest file permission adds_____ ___ to allow your application to read the device’s address book.
26. ____________allows the user to flip left and right through pages of Data.
33. List View has a function to display a list of uniquely defined Views other than Text [ ]
View.
34. You can create a custom view by extending class Activity [ ]
SQLite is another data storage available in Android where we can store data in the user’s device and can
use it any time when required. In this article, we will take a look at creating an SQLite database in the
Android app and adding data to that database in the Android app. This is a series of 4 articles in which
we are going to perform the basic CRUD (Create, Read, Update, and Delete) operation with SQLite
Database in Android.
SQLite Database is an open-source database provided in Android which is used to store data inside the
user’s device in the form of a Text file. We can perform so many operations on this data such as adding
new data, updating, reading, and deleting this data. SQLite is an offline database that is locally stored in
the user’s device and we do not have to create any connection to connect to this database.
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android
Studio. Note that select Java as the programming language.
Navigate to the app > AndroidManifest.xml and add the below code to it.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
/>
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the
code for the activity_main.xml file.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="@+id/idEdtCourseName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
<EditText
android:id="@+id/idEdtCourseDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
<EditText
android:id="@+id/idEdtCourseTracks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Enter Course Tracks" />
<EditText
android:id="@+id/idEdtCourseDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
<Button
android:id="@+id/idBtnAddCourse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Add Course"
android:textAllCaps="false" />
</LinearLayout>
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
@Override
SQLiteDatabase db = this.getWritableDatabase();
values.put(NAME_COL, courseName);
values.put(DURATION_COL, courseDuration);
values.put(DESCRIPTION_COL, courseDescription);
values.put(TRACKS_COL, courseTracks);
db.close();
@Override
onCreate(db);
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
courseNameEdt = findViewById(R.id.idEdtCourseName);
courseTracksEdt = findViewById(R.id.idEdtCourseTracks);
courseDurationEdt = findViewById(R.id.idEdtCourseDuration);
courseDescriptionEdt = findViewById(R.id.idEdtCourseDescription);
addCourseBtn = findViewById(R.id.idBtnAddCourse);
// below line is to add on click listener for our add course button.
addCourseBtn.setOnClickListener(new View.OnClickListener() {
@Override
return;
dbHandler.addNewCourse(courseName, courseDuration,
courseDescription, courseTracks);
courseNameEdt.setText("");
courseDurationEdt.setText("");
courseTracksEdt.setText("");
courseDescriptionEdt.setText("");
}
});