Android Question How to create a picture-in-picture scale view?

parswp

Member
Solved
B4X:
Sub Label1_Click
    Try
        Dim jo As JavaObject
        jo.InitializeContext
        jo.RunMethod("pip_activity", Null)
    Catch
        Log(LastException)
    End Try
End Sub

#If JAVA
    import android.os.Build.VERSION;
    import android.view.View;
    import android.widget.Toast;
        
    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
        try {
            if (isInPictureInPictureMode) {
                Toast.makeText(this, "in picture in picture mode.", Toast.LENGTH_SHORT).show();
            } else {           
                Toast.makeText(this, "out of picture in picture mode.", Toast.LENGTH_SHORT).show();       
                        
            }
        } catch (IllegalStateException e) {
            e.printStackTrace();
         }
    }   
    
    public void pip_activity(){     
     try {
        if (VERSION.SDK_INT >= 26) {
             this.enterPictureInPictureMode();
         }
     } catch (IllegalStateException e) {
        e.printStackTrace();
     }
    
    return;
    }
#end if

manifest:
SetActivityAttribute(YourActivity, android:resizeableActivity, "true")
SetActivityAttribute(YourActivity, android:supportsPictureInPicture, "true")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…