A ListView is a widget that shows items in a vertical scrolling list. An Adapter object is used to fill the ListView with data. ListView Widget I In the example, we show a ListView widget with the names of the planets of our solar system. We use an ArrayAdapter to fill the ListView with data. main.xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical”Continue Reading

ProgressBar I We have a horizontal ProgressBar widget and a TextView widget that shows the percentage of the task completed. The manifest file is left untouched. main.xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <ProgressBar android:id=”@+id/pbId” android:layout_width=”fill_parent” android:layout_height=”wrap_content” style=”?android:attr/progressBarStyleHorizontal” android:layout_margin=”10dp” /> <TextView android:id=”@+id/tvId” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_margin=”10dp” /> </LinearLayout> In the main.xml layout file, weContinue Reading

The SeekBar widget is used to select a value from a range of values. The user drags a thumb of the widget to select a specific value. To process the SeekBar events, we implement the SeekBar.OnSeekBarChangeListener listener. SeekBar example We have a SeekBar widget and a TextView widget. The current value from the SeekBar is displayed in the TextView. Android manifest file isContinue Reading

A spinner widget enables a user to select an item from a list of options. In the normal state it shows the currently selected item. Clicking on the spinner widget shows a dropdown menu with all available items. The user can choose a new one from the list. The Spinner class isContinue Reading

When we design the user interface of our application, we decide what components we will use and how we will organise those components in the application. To organise our components, we use specialised non visible objects called layout managers. There are several layout managers in Android. A LinearLayout lines up its viewsContinue Reading

According to the Android developer documentation, an Intent is an asynchronous message. It is an abstract description of an operation to be performed. Intents are used to navigate through activities. Activities, services and broadcast receivers are activated through intents. Intents enable loose coupling of code in the application. An Intent is passed to theContinue Reading

A Button class represents a push button widget in Android. The full package path for the button class is android.widgets.Button. Buttons are clicked to perform an action. A button can display text or an icon, or both. Event handlers for Button click events are defined with the android:onClick attribute of the <Button> element or programmatically by setting the setOnClickListener(View.OnClickListener).Continue Reading

What is SQLite? SQLite is an open source database. It supports standard relational database features like SQL syntax, transactions, prepared statement, etc. It has methods to create, delete, execute SQL commands and perform other common database management tasks. SQLite supports following datatypes: Datatype Description TEXT It is similar to StringContinue Reading

Android Application Components (Activities, Intents, Views, Layouts, Services) In android, application components are the basic building blocks of an application and these components will act as an entry point to allow system or user to access our app. The following are the basic core application components that can be used in AndroidContinue Reading

Creating app in Android Studio is very easy. Before starting actual programming make sure you have set your environment and Android SDK path properly. You can follow the steps in this tutorial to do this. Let’s start from the scratch. Creating the Android project Create a new project. Go to File menu => New and then select NewContinue Reading