Picture in Picture - Android Studio - Kotlin
Picture in Picture - Android Studio - Kotlin
Video:
<activity android:name=".PIPActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orienta
android:launchMode="singleTask"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"/>
Step 3: Code
AndroidMenifest.xml
<activity android:name=".PIPActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orienta
android:launchMode="singleTask"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
actiivty_main.xml
</LinearLayout>
MainActivity.kt
package com.blogspot.atifsoftwares.pictureinpicture
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
//video links/url
private val videoOneUrl = "https://commondatastorage.googleapis.com/gtv-videos-bu
private val videoTwoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bu
private val videoThreeUrl = "https://commondatastorage.googleapis.com/gtv-videos-
activity_pip.xml
</RelativeLayout>
PIPActivity.kt
package com.blogspot.atifsoftwares.pictureinpicture
import android.app.PictureInPictureParams
import android.content.Intent
import android.content.res.Configuration
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.Rational
import android.view.View
import android.widget.MediaController
import android.widget.Toast
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_p_i_p.*
videoUri = Uri.parse(videoURL)
Great 👍
REPLY
REPLY
REPLY
REPLY
REPLY
Android Tutorials
Enter your comment...
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 …
READ MORE
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
READ MORE
Export an Android Studio project as a ZIP le Starting with the Android Studio 3.0, you can
use File | Export to Zip File... to export your project to zip or HTML easily. There is also a
great advantage of exporting the project as a zip le, that is, it exports in very small size …
READ MORE
Powered by Blogger
Atif Pervaiz©
ATIF PERVAIZ
VISIT PROFILE
Menu
Android Tutorials
Home
ActionBar
SQLite
Android Video
Tutorials
AlertDialog
ListView
Android Menu
Activities
Libraries
Firebase
Splash Screen
Toast
SnackBar
WebView
Button
Spinner
CheckBox
Recyclerview
Bottom Sheet
SharedPreferences
Date Picker
Time Picker
Labels
My Gigs
Seller
Programming & Tech