This video shows the code to create your own in-app screen mirroring/ casting option for Android App.
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details/ steps of this video are posted in the below link:
package com.programmerworld.screenmirrorcastingapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonScreenMirror(View view){
Intent intentScreenSharing = new Intent("android.settings.CAST_SETTINGS");
startActivity(intentScreenSharing);
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Programmer World! \n\nThis is a sample text."
android:textSize="34sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="136dp"
android:layout_marginTop="58dp"
android:onClick="buttonScreenMirror"
android:text="Screen Mirror"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Screenshots:
Excerpts:
The provided video demonstrates how to create an in-app screen mirroring/casting option for Android apps. It includes the code for initiating the mirroring feature and provides details on the complete source code and steps. For inquiries, suggestions, or appreciation, the creators can be contacted via the website and email provided. The code snippet includes the package and an example class for implementing the screen mirroring functionality in an Android app. The XML layout file consists of a sample text and a button to initiate the screen mirroring.