Custom ListView with images

This tutorial shows how to display a String list and a list of images in a Custom ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView … Read more

Custom ListView for String List

This tutorial shows how to display a String list in a Custom ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView mainListview1. Step 3: In res/layout/ … Read more

ListView Example

This tutorial shows how to display a String list in a ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView mainListview1. Step 3: Open app/src/main/java/package and open … Read more

Custom Toast Message

This tutorial shows how to create a custom Toast message from a CustomView in xml, and display it in android app. Here the custom Toast will display an icon with white text (displaying current time) in a rectangle with red background and 10dp elevation. Follow the steps given below. Step 1: Create a new project with … Read more

Android Camera Example

This tutorial shows how to launch camera in android, capture an image, and display the captured image in an ImageView. It is easy, just follow the steps given below. Step 1: Create a new project with name CameraExample and package name com.myexample.camera. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) … Read more

Simple Intent operations

An Intent is a description of an operation or action to be performed. It can be used to launch an activity, to start or interact with a background service, or to send data to Broadcast receiver components. Below are some code snippets using Intent for commonly performed operations in android. Move from one Activity to … Read more

Create Stopwatch Android App

To create a stopwatch app for android, we can use android Chronometer. Here we will create a simple Stopwatch with an START/STOP button and a PAUSE/RESUME button. Step 1: Create a new project with name StopWatch and package name com.myexample.stopwatch. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add … Read more

Chronometer Example

Android Chronometer can be used to display a simple timer. It can be given a start time (considered 00:00) from which it counts up. The base time can be set by using SystemClock.elapsedRealtime() method. Step 1: Create a new project with name ChronometerExample and package name com.myexample.chronometer. Select File/New/New Project. Fill the forms and click “Finish” button. … Read more

Create OptionsMenu programmatically

The options menu is the primary collection of menu items for an activity. The menu items are displayed on the ActionBar. Step 1: In res/drawable/ directory add icons to be used in OptionsMenu. Take for example ic_add_white, ic_settings_white_24dp, and ic_info_outline_white. Step 2: Open app/java/package and open MainActivity.java(or the relevant java file). To specify the options menu for … Read more

Digital Clock App using TextClock

Here we will create a simple Digital Clock android app, which displays the current date, current time and day. Step 1: Create a new project with name ‘Digital Clock’ and package name com.myexample.clock. Fill the forms and click “Finish” button. Step 2: Open res -> layout -> xml (or) main.xml and add codes for displaying a TextClock. Step 3: Open app … Read more