0% found this document useful (0 votes)
32 views7 pages

Mid Android

The document provides an overview of various concepts related to Android development, including the storage of UI design files, the role of the Android Virtual Machine (AVM), and the structure of the resources folder. It explains key components such as the R.java file, intent filters, and the Android activity lifecycle, along with details on REST APIs and Retrofit for network requests. Additionally, it includes a sample program for inserting data into an SQLite database and references for further reading on Android architecture and services.

Uploaded by

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

Mid Android

The document provides an overview of various concepts related to Android development, including the storage of UI design files, the role of the Android Virtual Machine (AVM), and the structure of the resources folder. It explains key components such as the R.java file, intent filters, and the Android activity lifecycle, along with details on REST APIs and Retrofit for network requests. Additionally, it includes a sample program for inserting data into an SQLite database and references for further reading on Android architecture and services.

Uploaded by

disecek477
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1. In which folder all the android UI Design file will stored.

 In Android, all the UI design files are stored in the res/layout folder.

2. AVM ________
 AVM stands for Android Virtual Machine.

3. In which file all the permission will be taken.


 In Android, all the permissions are declared in the AndroidManifest.xml
file.

4. What is OHA
 OHA stands for Open Handset Alliance.
 It is a group of companies led by Google that work together to develop
open standards for mobile devices.
 OHA created the Android operating system, which is open-source and
widely used on smartphones.
 Members include companies like Samsung, HTC, Intel, and Qualcomm,
who contribute to the development and advancement of Android.

5. What is R.Java File in android


 In Android development, the R.java file is an automatically generated file
that contains references to all the resources in your Android project.
These resources include layouts, strings, images, styles, and more.
 Resource Identification: The R.java file is used to access resources in
your project using a unique identifier for each resource (like
R.layout.activity_main or R.string.app_name).
 Auto-Generated: It is automatically generated by the Android build
process, and you don’t need to manually edit it.
 Resource Access: It allows the app to access resources through a simple
reference instead of hardcoding paths, ensuring proper and efficient
resource management.

6. Explain RES folder in detail


 The res (resources) folder in Android is a directory that contains various
types of resources used in an Android application. These resources are
not part of the app's code but provide essential data, such as layouts,
strings, images, styles, and more. These resources are placed in specific
subfolders within the res directory to organize them properly.
 Key Subfolders in the res folder:
 res/layout/:

 Contains XML files defining the layout of UI elements (e.g.,
activity_main.xml). These files specify how the user interface will look.
 res/values/:

 Contains XML files that define various values used in the app, such as
strings (strings.xml), colors (colors.xml), styles (styles.xml), and
dimensions (dimens.xml).
 res/drawable/:

 Stores images and other drawable resources (e.g., PNG, JPG files). It can
also include XML files that define drawable shapes, selectors, and other
graphical elements.
 res/anim/:

 Contains XML files defining animations, such as tween animations or
frame-by-frame animations. These files allow you to animate UI
elements.
 res/mipmap/:

 Stores app launcher icons in various resolutions. It is similar to the
drawable folder but specifically designed for launcher icons.
 res/raw/:

 Holds raw files, such as audio or video files, which can be accessed
directly from the app.
 res/menu/:

 Contains XML files that define the app's menu structure, which can be
inflated in the activity's onCreateOptionsMenu() method.
7. Explain intent filter
 An Intent Filter in Android is used to declare the types of intents
(messages) that a component (such as an activity, service, or broadcast
receiver) can handle. It specifies the conditions under which a
component will be invoked, based on the intent's action, data type,
category, etc.
 Purpose: An intent filter allows the system to match an incoming intent
with the appropriate component (activity, service, or broadcast
receiver).
 Defined in the Manifest: It is defined in the AndroidManifest.xml file for
each component, typically within the <activity>, <service>, or <receiver>
tags.
 Example: If you want an activity to handle a particular action, such as
viewing a webpage, you can define an intent filter with the action
android.intent.action.VIEW.
 Example:

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

 In this example, MainActivity will respond to the VIEW action, indicating


that it can handle view intents, such as opening a URL.

8. Explain android activities life cycle in detail


 https://developer.android.com/codelabs/android-fundamentals-02-2-
activity-lifecycle-and-state#0
 https://www.javatpoint.com/android-life-cycle-of-activity
 https://www.geeksforgeeks.org/activity-lifecycle-in-android-with-demo-
app/
9. Explain android architecture
 https://www.javatpoint.com/android-software-stack
 https://www.geeksforgeeks.org/android-architecture/
 https://developer.android.com/guide/platform

10.In which folder animation will be stored


 In Android, animations are stored in the res/anim/ folder. This folder
contains XML files that define various types of animations, such as
tween or frame-by-frame animations.

11.What is canvas
 In Android, a Canvas is a class used to draw on a given surface, such as
the screen or a bitmap. It provides a set of methods that allow
developers to draw shapes, text, images, and other graphics.
 Drawing Surface: It acts as a drawing surface, and you can use it to
render custom graphics in your app.
 Common Methods: Methods like drawText(), drawCircle(), drawRect(),
and drawBitmap() are used to draw different elements.
 Used in Custom Views: Typically, Canvas is used within the onDraw()
method of a custom view to create custom UI elements or animations.

12.Which layout is used to arrange control only horizontal or vertical way


 The LinearLayout is used to arrange controls (UI elements) either
horizontally or vertically in Android. You can set the orientation of the
layout to horizontal or vertical using the android:orientation attribute.

13.Explain view V/s view group


 https://www.geeksforgeeks.org/difference-between-view-and-
viewgroup-in-android/
 https://www.scaler.com/topics/view-in-android/

14.Explain types of services in android


15.Explain context in android
16.Explain activity in android
17.What is intent? Explain types of intent
18.Explain Twined animation with example
19.What is REST API
 A REST API (Representational State Transfer API) in Android is a set of
web-based protocols that allows communication between an Android
app and a server over the HTTP protocol. It enables the app to send
requests (like GET, POST, PUT, DELETE) to access or modify data on the
server, and the server responds with data in formats like JSON or XML.
 Stateless: Each request from the client to the server must contain all the
information needed to understand and process the request.
 Data Communication: Commonly used for exchanging data between the
app and a remote server.

20.What is Retrofit
 Retrofit is a type-safe HTTP client for Android and Java, used for making
network requests to REST APIs. It simplifies the process of connecting to
a web service and parsing the response into Java objects. Retrofit
automatically handles the conversion of the API response (usually in
JSON) into objects you can use in your app.
 Ease of Use: It reduces boilerplate code for networking and handling API
responses.
 Integration: Works well with JSON converters like Gson or Moshi to
parse the response.

21.Write a program to insert data inside SQLite


 Here is a simple program to insert data into an SQLite database in
Android:

// Import necessary classes


import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {

// Define SQLite database name and table name


private static final String DATABASE_NAME = "MyDatabase";
private static final String TABLE_NAME = "User";

// Define column names


private static final String COL_ID = "id";
private static final String COL_NAME = "name";
private static final String COL_AGE = "age";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// Create or open the database


SQLiteOpenHelper dbHelper = new SQLiteOpenHelper(this,
DATABASE_NAME, null, 1) {
@Override
public void onCreate(SQLiteDatabase db) {
// Create table if it doesn't exist
db.execSQL("CREATE TABLE " + TABLE_NAME + " (" +
COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COL_NAME + " TEXT, " +
COL_AGE + " INTEGER)");
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
};
// Get writable database
SQLiteDatabase db = dbHelper.getWritableDatabase();

// Prepare data to insert


ContentValues values = new ContentValues();
values.put(COL_NAME, "John Doe");
values.put(COL_AGE, 25);

// Insert data into the database


long rowId = db.insert(TABLE_NAME, null, values);

// Check if insertion is successful


if (rowId != -1) {
Toast.makeText(this, "Data Inserted Successfully",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Data Insertion Failed",
Toast.LENGTH_SHORT).show();
}

// Close the database


db.close();
}
}

22.Explain SQLite architecture briefly


 https://www.sqlite.org/arch.html

You might also like