Posts

Showing posts from April, 2020

Time Picker in Android.

Image
Welcome to AndroidEasy. Today we will see how to create TimePicker in android application in easiest way. Step 1:   Create a new project in Android Studio.( Select  File ⇒ New ⇒ Android Project  and give                       activity  name as   Time Picker . ) Step 2:   Open timePicker_activity.xml file and Paste below code into it. <? xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     tools:context=".MainActivity">     <TimePicker      ...

Create an android app that demonstrates Activity Lifecycle and Instance State.

Image
In this tutorial we will see the working of Activity lifecycle step by step. Activity  life cycle consists of 7 methods as below. onCreate()  -   Invoked when Activity is created. onStart()  -       Invoked   when Activity is becoming visible. onResume()  - Invoked when Activity starts Interacting with user. onPause()  -    Invoked when Activity is invisible to user onStop()  -       Invoked when activity is no longer visible. onRestart() -  Invoked   after your activity is stopped, prior to start. onDestroy()  - Invoked  before Activity is killed. Let's begin coding .... 💻💻 Step 1: After creating Android project, open activity_main.xml file and paste below code as it is. activity_main.xml <?xml  version="1.0" encoding="utf-8" ?>    <android.support.constraint.ConstraintLayout  xmlns:andr...

Create android app that demonstrates working with TextView elements.

Image
In this tutorial we will see some TextView properties to create custom TextViews in android.  We are going to use three TextViews and will apply different styles to them in this project. Step 1:create new project in android studio             == >new ==>new project ==>select EmptyActivity ==>click next ==>finish Step 2: Open activity_main.xml file and paste below code. <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"      xmlns: app = "http://schemas.android.com/apk/res-auto"      xmlns: tools = "http://schemas.android.com/tools"      android :layout_width= "match_parent"      android :layout_height= "match_parent"      android :gravity= "center"      android :orientation= "vertical"    ...