Moving between fragments

This post describes how open different fragments from a menu fragment in an Activity. Create a new empty project in Android Studio. Create your layout in activity_main.xml. Add a FrameLayout here. Add menu_fragment.xml with four buttons. Add MenuFragment.java use following codes. In on click events of button1, button2, button3, and button4, we display AddFragment, SubtractFragment, … 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

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

AutoCompleteTextView Example

An AutoCompleteTextView is a View that is similar to EditText, except that it shows a list of completion suggestions automatically while the user is typing. Here we will create a simple app which displays an AutoCompleteTextView in which we can type the name of any international airport in India. The app will display the list … Read more

ProgressBar

ProgressBar is a user interface element that indicates the progress of an operation. Progress bar supports two modes to represent progress: determinate, and indeterminate. We should display progress bars to a user in a non-interruptive way in the app’s user interface or in a notification instead of within a dialog. ProgressDialog has been deprecated in … Read more

SeekBar example

Android SeekBar is an user interface element that contains a draggable thumb and represents progress of an operation. The user can touch the thumb and drag left or right to set the current progress level. For the SeekBar, bY default, minimum progress is 0 and maximum progress is 100. Step 1: Create a new project with name Seekbar … Read more

Android RatingBar

Android RatingBar Example. Android RatingBar can be used to display a Rating bar containing 5 stars which can be used to display rating or set rating out of 5. Step 1: Create a new project with name ratingbarexample and package name com.myexample.myratingbar. Select File -> New -> New Project. Fill the forms and click “Finish” button. Step 2: Open res -> … Read more

Android ToggleButton

Android ToggleButton Example. Android Toggle Button can be used to display checked/unchecked (On/Off) state on the button. It is beneficial if user have to change the setting between two states. Step 1: Create a new project with name toggleexample and package name com.myexample.mytoggle. Select File -> New -> New Project. Fill the forms and click “Finish” button. Step 2: Open res … Read more

Android Switch Example

A Switch is a two-state toggle switch widget that can select between two options. The user may drag the “thumb” back and forth to choose the selected option, or simply tap to toggle as if it were a checkbox. Step 1: Create a new project with name switchexample and package name com.myexample.myswitch. Select File -> New -> … Read more