How well do you know Android?

Here are some common questions and answers regarding Android development. I compiled these questions and answers from posted interview questions, stack-overflow, trivia, documentation and other various sources. This is not a how-to, but a more general description of things I believe you should know to become a rockstar Android development. In the future I may expand on some of these topics as their own articles, but for now: enjoy!


Does Android include an internal database?

Yes! Android uses the open-source, stand-alone SQL database, SQLite. This is accessible via the command line of a connected device in developer debug mode. The access is limited to single instances of the app, but you can access remotely. Android studio contains a command-line interface called sqlite3 which can remote right in. The database can also be as large or as small as you wish.

The DB files are stored in the package manager …/projectName/databases. The Android java libraries include methods manipulate and query the database .


What is a ViewGroup?

“View: the most over-used word in the the Android development environment. Le Sigh.”

ViewGroup actually means two separate, but closely related things.

  1. In Java, the ViewGroup class is an abstract class that all Layouts extend. ViewGroup is an invisible container for all of the other Layouts.
  2. A ViewGroup is also an umbrella term to help categorize those layouts in XML. So, LinearLayout and RelativeLayout are examples of what we would call ViewGroups in the XML layout editor.


What is an Activity?

“A single, focused thing that the user can do.” – official Android documentation

An app cannot exist without at least one activity, even a WebView app is a single activity. In Android, an activity is represented by a single screen. Most applications have multiple activities to represent their various screens. Activities contain the UI elements of the application. More than one activity can be on the screen at the same time as a floating window or embedded within another activity. In java, Activity is a class. The official Android documentation provides an excellent overview of the lifecycle and states of an activity.

An activity has essentially four states:

  • If an activity is in the foreground of the screen (at the top of the stack), it is active or running.

  • If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.

  • If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.

  • If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.


The lifecycle of an activity is based on 7 key methods. OnCreate

public class Activity extends ApplicationContext {
protected void onCreate(Bundle savedInstanceState);

protected void onStart();

protected void onRestart();

protected void onResume();

protected void onPause();

protected void onStop();

protected void onDestroy();



speaking of activities…

What is a Fragment?

A fragment represents a behavior or a portion of user interface within an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own life cycles, receives its own input events, and which you can add or remove while the activity is running.