Android:concepts

From Juneday education
Jump to: navigation, search


Activity

To give your application a visible user interface you use one or many Activities. In an Activity we can use Views and Fragments to build up the user action.

Introduced in lecture: Android basics.

Read more about Activity on Actvity.

Android Monitor

Android Monitor helps you to profile the performance of your apps so you can optimize, debug, and improve them. It lets you monitor the following aspects of your apps - Android Monitor

Id

Every resource (image, Button, layout, String…) gets an ID. This ID is generated at compile time and is used in runtime to “look up” (find) a View and possibly use that View.

These IDs are integer (actually static int) stored in a file called R.java. When building your project this file gets compiled as well and you can use methods such as:

Introduced in: Android Basics

Layout

The visual interface (e g Activity) is defined with a layout.

Introduced in lecture: Android basics

Log

Use the Log API in Android if you want to log output. Declare a tag as a static String in your class:

private static final String TAG = "MyActivity";

or why not:

private static final String TAG = Storage.class.getSimpleName();
assuming your class' name is Storage.

and then Log messages like this (in the same class of course):

Log.v(TAG, "index=" + i);


Log.

View

A View in Android is either:

  • Widget (window gadget) such as Button, EditText, ToggleButton, RadioButton and Spinner
  • Layout (see above)

Introduced in lecture: Android basics