A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 101

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 127

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$hooks is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$config is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$log is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$uri is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$router is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$output is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$security is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$input is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$lang is deprecated

Filename: core/Controller.php

Line Number: 82

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$db is deprecated

Filename: core/Loader.php

Line Number: 396

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_DB_mysqli_driver::$failover is deprecated

Filename: database/DB_driver.php

Line Number: 371

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 1283

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 132

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 294

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 168

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 237

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 317

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 358

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 289

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 375

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Session cannot be started after headers have already been sent

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$session is deprecated

Filename: core/Loader.php

Line Number: 1283

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$upload is deprecated

Filename: core/Loader.php

Line Number: 1283

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 6
Function: __construct

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Details::$details_model is deprecated

Filename: core/Loader.php

Line Number: 358

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 7
Function: model

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$db is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$session is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$upload is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$details_model is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/application/controllers/Details.php
Line: 17
Function: view

File: /home1/lobhiaeg/public_html/blog.roytechnoworld.co.in/index.php
Line: 315
Function: require_once

Switch between activities in android a step by step guide - MyAndroidMaster

Beginner

Switch between Activities in Android - Best Step by Step Guide

In this lesson, you add some code to the MainActivity that starts a new activity to display. Also switch between two activities. Here is my video where you can get the full code with my live codes. to watch this video You can understand what exactly you are going to code

2022-04-06
Share this

This example demonstrates how to switch between different Activities in Android. Create a new project . Here we need two Activities to switch between. Add these following code to MainActivity.java

public class MainActivity extends AppCompatActivity {

    Button click_first_btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        click_first_btn = findViewById(R.id.click_first_btn);
        click_first_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                 Intent i = new Intent(getApplicationContext(),SecondActivity.class);
                 startActivity(i);
            }
        });
    }
}

Now create another Activity and named that SecondActivity.java. Add this code to that

public class SecondActivity extends AppCompatActivity {

    Button click_second_btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        click_second_btn = findViewById(R.id.click_second_btn);
        click_second_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(SecondActivity.this,MainActivity.class);
                startActivity(i);
            }
        });

    }
}

This example demonstrates how to switch between different Activities in Android. Create a new project . Here we need two Activities to switch between. Add these following code to MainActivity.java

<?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"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Im First Activity" />

    <Button
        android:id="@+id/click_first_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Click to go Second"/>

</LinearLayout>

This example demonstrates how to switch between different Activities in Android. Create a new project . Here we need two Activities to switch between. Add these following code to MainActivity.java

<?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"
    tools:context=".SecondActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Im Second Activity"  />

    <Button
        android:id="@+id/click_second_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Click to go First"/>

</LinearLayout>

This example demonstrates how to switch between different Activities in Android. Create a new project . Here we need two Activities to switch between. Add these following code to MainActivity.java

Read next

Using Custom and Downloadable Fonts in Android

To work with Custom Font, you need to install the latest version of Android Studio. A font resource defines a custom font that you can use in your app. Fonts can be individual font files or a collection of font files

Thu, 14 Apr 2022

Modal Bottom Sheet in Androidx with Examples - Working with BottomSheet

A user can view the full Bottom Sheet by dragging the sheet up vertically. Bottom Sheets are a lesser known part of the Design support library.
Thu, 21 Apr 2022

Using Custom and Downloadable Fonts in Android

To work with Custom Font, you need to install the latest version of Android Studio. A font resource defines a custom font that you can use in your app. Fonts can be individual font files or a collection of font files
Thu, 14 Apr 2022