Bus Booking Application Android Studio

Bus Booking Application Android Studio – In this article I will explain how develop online android bus booking system using android studio IDE. Nowadays everyone books their ticket in online, because more offers, time saving, online payment, no manual works & lot of advantages. That’s the reason for everyone migrate from offline to online system.

Alternatively you can earn money part time work. For do that just one laptop/desktop enough to make incomes internet. Billions of peoples doing this works like Earn Money Rs.600 per Day from workplace or anywhere.

Popular bus service is RedBus most good services. Because they give more offers & competition with offline customers.

Create New Project

Let’s start our online ticket booking android app on android studio. You can use this application in various domain like bus, car, airplane, train booking online platform. Assume you already know the basic steps of project, package, activity creation, SDK version.

package com.minemark.platform.busbookingappui;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    Button search_buses;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);
        search_buses = findViewById(R.id.search_buses);
        search_buses.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getApplicationContext(),Main2Activity.class);
                startActivity(intent);
            }
        });
    }
}

Bus Booking Application Project Screenshot

Here the output of android ticket booking application. Few modules screenshot only i have added. Other features you can access to your emulator device. Current days everyone using online mode for book their bus tickets. Because some companies are give offers like cashback, coupon code, git card etc. Another one advantage is we easily book our favorite place.

XML Layout

Now we need to integrate java file into XML file. But Designs are implemented via drag and drop way. Alternatively develop the code in manual way also. Open the default file activity_main.xml & add the following below code.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#512da8"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:elevation="0dp">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:theme="@style/AppTheme.Toolbar">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="16dp">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentTop="true"
                    android:src="@drawable/ic_person_outline_white_24dp" />

            </RelativeLayout>

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="-16dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="260dp"
                        android:scaleType="centerCrop"
                        android:src="@drawable/bus_image_1" />

                    <TextView
                        android:id="@+id/textView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="16dp"
                        android:fontFamily="@font/print_clearly"
                        android:text="Hey Shanky!"
                        android:textAlignment="center"
                        android:textColor="#FFFFFF"
                        android:textSize="32sp" />

                    <TextView
                        android:id="@+id/textView2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/textView"
                        android:layout_marginTop="8dp"
                        android:fontFamily="@font/gotham"
                        android:text="Where you want to go."
                        android:textAlignment="center"
                        android:textColor="#FFFFFF"
                        android:textSize="18sp" />

                </RelativeLayout>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="8dp"
                    android:layout_marginRight="8dp"
                    android:layout_marginTop="-44dp"
                    app:cardCornerRadius="8dp"
                    app:cardUseCompatPadding="true"
                    app:contentPadding="16dp">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:layout_marginBottom="16dp"
                        android:orientation="vertical">

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="8dp"
                            android:textColorHint="#FF8A99AF">

                            <EditText
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:drawablePadding="16dp"
                                android:drawableStart="@drawable/ic_location_on_light_blue_24dp"
                                android:fontFamily="@font/calibri"
                                android:hint="Destination"
                                android:inputType="text"
                                android:maxLines="1"
                                android:textColor="@android:color/black"
                                android:textSize="16sp" />
                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="8dp"
                            android:textColorHint="#FF8A99AF">

                            <EditText
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:drawablePadding="16dp"
                                android:drawableStart="@drawable/ic_location_on_light_blue_24dp"
                                android:fontFamily="@font/calibri"
                                android:hint="From"
                                android:inputType="text"
                                android:maxLines="1"
                                android:textColor="@android:color/black"
                                android:textSize="16sp" />
                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="8dp"
                            android:textColorHint="#FF8A99AF">

                            <EditText
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:drawablePadding="16dp"
                                android:drawableStart="@drawable/ic_date_range_light_blue_24dp"
                                android:fontFamily="@font/calibri"
                                android:hint="Select Date"
                                android:inputType="date"
                                android:maxLines="1"
                                android:textColor="@android:color/black"
                                android:textSize="16sp" />
                        </android.support.design.widget.TextInputLayout>

                    </LinearLayout>

                </android.support.v7.widget.CardView>


                <Button
                    android:id="@+id/search_buses"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_margin="16dp"
                    android:background="@drawable/buttonshape"
                    android:fontFamily="@font/calibri"
                    android:text="Search Buses"
                    android:textAllCaps="false"
                    android:textStyle="bold"
                    android:textColor="#ffffff"
                    android:textSize="18sp" />
            </LinearLayout>


        </ScrollView>

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>

Bus Booking Application Android Studio

I hope this article helps to develop online bus ticket. Download free source code here & facing any issues just comment below I will help to solve the problem. So this project user interface like redbus app, so surely you like this application. Finally you can customize designs as your wish.

Leave a Reply