Posts

Showing posts with the label Android Kotlin Tutorials

AlertDialog with custom layout (Kotlin)

Image
How to create Create AlertDialog With Custom Layout (Kotlin)?      DESCRIPTION      This tutorial will show how to create and show an AlertDialog with C ustom Layout containing views such as EditTexts and Buttons etc. We will show AlertDialog on Button click. Custom layout will contain three EditTexts and two Buttons . When information is entered in EditTexts , Press Login Button , Dialog will be dismissed, and the information will be set to the TextView .      VIDEO           SOURCE CODE      Step 1:  Create a new Project  or  open new project Step 2: Create new Layout Resource file 'login_dialog.xml' under res>layout folder Step 3: Code activity_main.xml <?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:too...

Adding Floating Action Button (Kotlin)

Image
The  Floating Action Button (FAB)  is a circular button that triggers primary action in your app's  UI . This tutorial shows you how to add the FAB to your layout, customize some of its appearance, and respond to the button taps. We will show  Snackbar  on  FAB  click. We will use  Kotlin  and  Android Studio . Minimum API: Android 2.1 is API level 7 Step 1:  Create a new project   OR   Open your project Step 2:  Add design library in build.gradle(Module:app) under dependencies{...} implementation 'com.android.support:design:27.1.0' Step 3:  Place an image in res>drawable folder Step 4: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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" ...

Splash Screen (Kotlin) - Android Studio

Image
      DESCRIPTION       In this tutorial i'll show you how to create a splash screen for your android app using android studio. We need at least two activities one is splash screen and second is some other activity that will display after splash screen.       VIDEO             SOURCE CODE       Step 1:  Create a new project   OR   Open your project Step 2:  Create New Activity File>New>Activity>EmptyActivity Step 3:  Place an image in res>drawable folder Step 4:  Open manifest and add android:theme="@style/Theme.AppCompat.Light.NoActionBar" in <activity  android :name= ".SplashActivity" ...> Step 5: Code AndroidMenifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= "com.blogspot.atifsoftwares.spla...

Pass Data between Activities using intent (Kotlin) - Android Studio Tutorial

Image
In this tutorial i'll show you how to pass data between different activities using intent. For Example in this tutorial  Activity 1: Input data using EditText and click Save Button to start second activity with the data that was input. Activity 2: Show the input data of previous activity using Intent. Step 1:  Create a new Project  or  open new project Step 2:  Create New Activity File>New>Activity>EmptyActivity Step 3: Code acitivity_main.xml <?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" android:gravity= "center" android:padding= "10dp...

Android Studio Tutorials - Kotlin

Image
This YouTube playlist is for learning developing Android Apps in Kotlin language using Android Studio especially for beginners. Related: Watch Android Studio Tutorials - Java

Add a Back Button to Action Bar Android Studio (Kotlin)

Image
      DESCRIPTION       In this tutorial we will add a back button in action bar, when it is clicked it will go to previous activity(the app will close if this was launcher activity). We will go from main activity to new activity by clicking button in main activity. In new activity we will add a back button to actionbar when that button is clicked the main activity will appear...       VIDEO             SOURCE CODE       Step 1:  Create a new Project  or  open new project Step 2: Create New Activity File>New>Activity>EmptyActivity Step 3: Code: activity_main.xml <?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" ...

How to move From one Activity to another Activity in Android Studio (Kotlin)

Image
      DESCRIPTION       In this tutorial we will learn how to open new Activity when a Button is clicked using Android Studio in Kotlin language. When button in an activity(Main Activity) is clicked the new activity(New Activity) will be opened..       VIDEO             SOURCE CODE       Step 1:  Create a new Project  or  open new project Step 2:  Create a new Activity(e.g. Empty Activity) Step 3: Code activity_main.xml <?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" tools:context= ".MainActivity" > <Button an...

Create a button and handle on click listener in Android Studio (Kotlin)

Image
How to create a button and handle OnClickListener in Kotlin using Android Studio?       DESCRIPTION       In this tutorial we will create a button and handle button click. We will display a Toast on the click of that button. However you can do your own functionality such as moving to some activity, opening fragment etc.       VIDEO             SOURCE CODE       Step 1:  Create a new Project  or  open new project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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" tools:context= ".MainActivity" > <Button ...

Create AlertDialog With Custom Layout Programmatically (Kotlin)

Image
How to create Create AlertDialog With Custom Layout Programmatically (Kotlin)?      DESCRIPTION      In this tutorial we will create AlertDialog with custom layout programmatically in Java using Android Studio IDE. We will create a button to show that AlertDialog and show output in a TextView. You can also display this information anywhere or save at some place like shared preferences, files, sqlite etc. I've added two TextViews and Two EditTexts with LinearLayout.      VIDEO           SOURCE CODE      Step 1:  Create a new Project  or  open new project Step 2: Code activity_main.xml <?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" ...