Android chapter - 1

1.Android LifeCycle?

To navigate transitions between stages of the activity lifecycle, the Activity class provides a core set of six callbacks:  onCreatre(),onStart(),onpause(), onResume(),onStop(),and onDestroy(). The system invokes each of these callbacks as an activity enters a new state.

2.what is Activity in Android?

Activities are one of the fundamental building blocks of apps on the Android platform. They serve as the entry point for a user\'s interaction with an app, and are also central to how a user navigates within an app (as with the Back button) or between apps (as with the Recents button).

3.What is Fragment in Android?

A Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.

4.What is AsyncTask in Android?

AsyncTask enables proper and easy use of the UI thread. This class allows you to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers

5.What are the methods in AsyncTask?

onPreExecute(); \n doInBackground() ; \n onPostExecute(); \n onProgressUpdate();

6.What is AlertDialog?

A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.

7.What is Layout?

A layout defines the visual structure for a user interface, such as the UI for an activity or appwidget. You can declare a layout in two ways: Declare UI elementsin XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. Instantiate layout elements at runtime. Your application can create View and ViewGroup objects (and manipulate their properties) programmatically.

8.What is User Permissions in Android ?

To maintain security for the system and users, Android requires apps to request permission before the apps can use certain system data and features. Depending on how sensitive the area is, the system may grant the permission automatically, or it may ask the user to approve the request

9.What is RunTime Permissions in Android?

If the device is running Android 6.0 or higher, and your app\'s target SDK is 23 or higher: The app has to list the permissions in the manifest,  and it must request each dangerous permission it needs while the app is running

10.What is View?

View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.)

11.What is ViewGroup?

The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties

12.What is Widgets in Android?

Widgets are an essential aspect of home screen customization. You can imagine them as "at-a-glance" views of an app\'s most important data and functionality

13.What is menifest in Android?

Every application must have an AndroidMenifest.xml file (with precisely that name) in its root directory. The manifest file provides essential information about your app to the Android system, which the system must have before it can run any of the app\'s code.

14.What are the Activity launchMode in Android ?

Standard Single Top Single Task Single Instance

15.What is Android?

Android is a software package and linux based operating system for mobile devices such as tablet computers and smartphones. \n It is developed by Google and later the OHA (Open Handset Alliance).

16.What are the Android Components in android?

Android components are the essential building blocks of an Android application. These components  are loosely coupled by the application manifest file. Activity , Service ,Intent Service , BroadCastReceiver

17.What is the android deployment output?

It is .apk file. To build and run your app, select Run>Run in the menu bar (or click Run in the toolbar). If it\'s the first time running the app, Android Studio asks you to

18.What is android emulator?

A virtual device that runs on your computer. The Android Emulator lets you develop and test Android apps without using a physical device

19.What is toast message in android ?

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout

20.What is log.w in android monitor?

Show possible issues that are not yet errors, as well as the message levels lower in this list.

21.What is log.e in android monitor?

Show issues that have caused errors, as well as the message level lower in this list.

22.What is log.d in android monitor?

Show debug log messages that are useful during development only, as well as the message levels lower in this list.

23.What is log.i in android monitor?

Show expected log messages for regular usage, as well as the message levels lower in this list..

24.What is log.v in android monitor?

Show all log messages (the default).

25.What is version Code?

The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.

26.What is version Name?

The value is a string so that you can describe the app version as a major.minor.point string, or as any other type of absolute or relative version identifier. The versionName has no purpose other than to be displayed to users.

27.What is proguard?

Proguard is free Java class file shrinker,optimizer,obfuscator,and preverifier.It detects and removes unused classes,fields,methods,and attributes

28.What is Thread?

A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. \n There are two ways to create a new thread of execution \n One is to declare a class to be a subclass of Thread \n The other way to create a thread is to declare a class that implements the Runnable interface. That class then implements the run method.

29.What is Actionbar?

The app bar, also known as the action bar, is one of the most important design elements in your app\'s activities, because it provides a visual structure and interactive elements that are familiar to users

30.What is Toolbar?

A Toolbar is a generalization of actionbar for use within application layouts. While an action bar is traditionally part of an activity\'s opaque window decor controlled by the framework. Toolbar was introduced in Android Lollipop, API 21.

31.What is Dependencies?

The Gradle build system in Android Studio makes it easy to include external binaries or other library modules to your build as dependencies

32.What is the use the service onStart command?

onStartCommand(): This is used for services that are explicitly started.

33.What is the adapter?

An Adapter object acts as a bridge between an adapterview and the underlying data for that view. The Adapter provides access to the data items. The Adapter is also responsible for making a view for each item in the data set.

34.What is the use the service onStart command?

onStartCommand(): This is used for services that are explicitly started.

35.What are the adapter types in android?

There are many types of adapter. \n 1.ArrayAdapter \n 2.CursorAdapter \n 3.SimpleCursorAdapter

36.Why we should use Adapter in android?

The Adapter provides access to the data items. The Adapter is also responsible for making a view for each item in the data set.

37.What is implicit Intent?

Implicit Intent do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it .

38.What is Explicit Intent?

Specify the component to start by name (the fully-qualified class name). You\'ll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start.

39.Layout difference?Relative, LinearLayout,FrameLayout,Constraint

RelativeLayout means based on relation of views from its parents and other views. \n LinearLayout means we can align views one by one (vertically/ horizontally). \n FrameLayout to load child one above another, like cards inside a frame, we can place one above another \n ConstraintLayout is similar to a RelativeLayout in that it uses relations to position and size widgets, but has additional flexibility and is easier to use in the Layout Editor.

40.what is Parcelable in android?

Parcelable is an Android specific interface where you implement the serialization yourself. \n It was created to be far more efficient that Serializable, \n and to get around some problems with the default Java serialization scheme.\n I believe that Binder and AIDL work with Parcelable objects.\n However, you can use Serializable objects in Intents.

41.What is Serializable in Android?

Serializable is a standard Java interface. we can just implement Serializable interface and add override methods.The problem with this approach is that reflection is used and it is a slow process. This method create a lot of temporary objects and cause quite a bit of garbage collection. Serializable interface is easier to implement.

42.What is Handler in Android?

A Handler allows you to send and process message and Runnable objects associated with a thread\'s message Queue. Each Handler instance is associated with a single thread and that thread\'s message queue.

43.What is ANR in Android?

When the UI thread of an Android app is blocked for too long(>5 sec), an \"Application Not Responding\" (ANR) error is triggered. If the app is in the foreground, the system displays a dialog to the user.

44.What is Crash in Android?

An Android app crashes whenever there\’s an unexpected exit caused by an unhandled exception or signal.

45.Difference between hdpi,mdpi,xhdpi,xxhdpi ?

These units are relative to a 160 dpi screen. \n px: Pixels - corresponds to actual pixels on the screen. \n Dp or dip: Density-independent Pixel,  an abstract unit that is based on the physical density of the screen. \n sp: Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user\'s font size preference

46.What is ADB??

Android Debug Bridge (adb) is a versatile command-line tool, The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

47.difference between Internal and External Storage?

External storage is phone memory card ,it is removable from device . Internal is phone memory sometimes needs an additional power source, Internal connected to the power supply in phone device.It is not seperate from device

48.how to mention camera permission in android?

he permission name is android.permission.CAMERA but we should find which mobile os is using either below marshmallow or not 1.user-permission \n 2.Runtime Permission (>marshmallow)

49.how to mention Location permission in android?

The permission name is android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION but we should find which mobile os is using either below marshmallow or not 1.user-permission \n 2.Runtime Permission (>marshmallow)

50.how to mention Contacts permission in android?

The permission name is android.permission.READ_CONTACTS and android.permission.WRITE_CONTACTS but we should find which mobile os is using either below marshmallow or not 1.user-permission \n 2.Runtime Permission (>marshmallow)

51.What are the android os version?

1.Gingerbread(2.3) \n 2.Honeycomb(3.0) \n3.Ice Cream Sandwich(4.0) \n 4.Jelly Bean(4.3/4.2/4.1) \n 5.KitKat(4.4) \n 6.Lollipop(5.0) \n 7.Marshmallow(6.0) \n 8.Nougat(7.0) \n 9.Oreo(8.0) \n 10.Pie(9.0)

52.why we need Firebase analytics?

Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user base, and earn more money. Firebase is made up of complementary features that you can mix-and-match to fit your needs.

53.what is Pending Intent?

A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it

54.what is use of Start sticky in service?

Start sticky is used for services that are explicitly started .

55.what is use of Start non sticky in service?

Start not stricky used for services that should only remain running while processing any commands sent to them

56.what is use of Start Redeliver in service? ?

Start Redeliver are used for services that should only remain running while processing any commands sent to them.

57.What is IBinder?

The key IBinder API is transact() matched by Binder.onTransact() . \n These methods allow you to send a call to an IBinder object and receive a call coming in to a Binder object, respectively.

58.What is Android?

Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets.

59.What is ADT?

The Eclipse ADT plugin has many known bugs and potential security bugs that will not be fixed.

60.What is DDMS?

Android Studio includes a debugging tool called the Dalvik Debug Monitor Server (DDMS)

61.What is AIDL?

AIDL (Android Interface Definition Language) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC)

62.What is AAPT?

AAPT stands for Android Asset Packaging Tool and is included in the tools/ directory of the SDK. This tool allows you to view, create, and update Zip-compatible archives (zip, jar, apk). It can also compile resources into binary assets.

63.What is Context?

Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes.

64.What is getApplicationContext?

This will Return the context for all activities running in application.

65.What is Lint?

Android Lint is a new tool introduced in ADT 16 (and Tools 16) which scans Android project sources for potential bugs . \n Example \n 1. Layout performance problems (all the issues the old layoutopt tool used to find, and more) \n 2. Icon problems (like missing densities, duplicate icons, wrong sizes, etc) \n 3. Manifest errors

66.What is Apk Extension?

Android Package kit

67.What is Application in android?

The Application class in Android is the base class within an Android app that contains all other components such as activities and services. The Application class, or any subclass of the Application class, is instantiated before any other class.

68.What is MemoryLeak in android?

GC would mark unused objects as useful object and therefore would not be able to remove them. This is called a memoryleak.

69.What is finish() will use in Android?

finish() method will destroy the current activity. You can use this method in cases when you dont want this activity to load again and again when the user presses back button.

70.How to change the activity one another?

An Intent is an object that provides runtime binding between separate components, such as two activities.

71.what is Pending Intent?

Since updating UI from other thread directly is not possible, Communicate with main UI thread for the UI updates. A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it

72.what is Intent Types?

Implicit Intent, Explicit Intent ,Pending Intent ,Sticky Intent

73.what is URIs in android?

A URI is a Uniform Resource Identifier

73.what is Sqlite in android?

SQLite is one way of storing user data. Saving data to a database is ideal for repeating or structured data, such as contact information.

74.How to create the database using SqliteHelper?

You create a subclass implementing onCreate(SQLiteDatabase), onUpgrade(SQLiteDatabase, int, int) and optionally onOpen(SQLiteDatabase), and this class takes care of opening the database if it exists, creating it if it does not, and upgrading it as necessary. Transactions are used to make sure the database is always in a sensible state.

75.Difference between setFlags and AddFlags?

Set flag controls how to handle the Intent.setflag mainly depends on type of component being executed by the Inten Set special flags controlling how this intent is handled. \n AddFlags helps to add additional flags to a particular intent with the existing values.this also returns the same intent object for chaining multiple calls into a single statement.

76.what is Tasks and BackStack?

Task: A task is a collection of activities that users interact with when performing a certain job. \n BackStack: In the order in which each activity is opened.

77.what is FLAG_ACTIVITY_CLEAR_TOP?

If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.

78.what is FLAG_ACTIVITY_NO_HISTORY?

If set, the new activity is not kept in the history stack.

79.what is FLAG_ACTIVITY_SINGLE_TOP?

If set, the activity will not be launched if it is already running at the top of the history stack.

80.what is single instance launchmode ?

singleInstance launchmode means activities can only begin a task. They are always at the root of the activity stack. Besides, the device can hold only one instance of the activity at a time

81.Difference Between ART and Dalvik?

ART(Android RunTime) is the next version of Dalvik. Dalvik  is the runtime, bytecode, and VM used by the Android system for running Android applications.

82.What is Intent in Android?

An Intent is a messaging object you can use to request an action from another app Component. Although intents facilitate communication between components in several ways.

83.What is Intent Filter in Android?

Structured description of Intent values to be matched. An IntentFilter can match against actions, categories, and data (either via its type, scheme, and/or path) in an Intent. It also includes a \"priority\" value which is used to order multiple matching filters.

84.What is Service in Android?

A Service is an application component that can perform long-running operations in the background, and it does not provide a user interface

85.What is Service Types?

1.Foreground \n 2.Background \n 3.Bound

86.What is IntentService in Android?

IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.

87.What is BroadCastReceiver in Android?

Declares a broadcast receiver (a Broadcastreceiver subclass) as one of the application\'s components. Broadcast receivers enable applications to receive intents that are broadcast by the system or by other applications, even when other components of the application are not running.

Ramasamy

I started to learn android and Kotlin and iOS and Hybrid application and i cant code IOS very well. But i love more interesting to code and finding new developer minds who are join to me You're welcome to keep on using my website.Instead, you can join our FB page for developer comments and post there: https://www.facebook.com/ramasamy.m.779 Best wishes :) Ramasamy(Software Developer)

Android Development and IOS Development & React Native Application

See what's new in Android & IOS & Hybrid development … explore and learn in site

About Ramasamy

Kotlin and React native example too

Related Posts