How to leave two screens in an activity, being able to change one of them via code

1

Good morning, afternoon or evening !! I need to make a screen in the android divide in the middle, where the screen above screen a video player, and the bottom a chat, where in a due event will be replaced by another screen, a call screen that when accepting would be one more replaced by another, without changing the top screen (the video player).

Tela um  
  tela 2        

Screen 1 will always remain, and screen 2 may be replaced with another screen, I tried fragment but unfortunately it gave error, so if someone can give me a light I am grateful, Thank you

[EDIT1]    the xml code that tried and gave error

<?xml version="1.0" encoding="utf-8"?>

>


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="fragmentAovivo.videoFragem"
    tools:layout="@layout/fragment_video_fragem"
    android:layout_weight="1"

    >
</fragment>


<ImageView
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:src="@mipmap/borda_chamada"
    />
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container2"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"


    tools:layout="@layout/fragment_chat">



</fragment>

ERROR.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.byb.tvcel/com.byb.tvcel.AoVivoScreen}: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
        at android.app.ActivityThread.access$600(ActivityThread.java:141)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
        at android.app.Activity.setContentView(Activity.java:1895)
        at com.byb.tvcel.AoVivoScreen.onCreate(AoVivoScreen.java:14)
        at android.app.Activity.performCreate(Activity.java:5133)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
        at android.app.ActivityThread.access$600(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:525) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.app.Fragment$InstantiationException: Trying to instantiate a class fragmentAovivo.videoFragem that is not a Fragment
        at android.app.Fragment.instantiate(Fragment.java:584)
        at android.app.Fragment.instantiate(Fragment.java:560)
        at android.app.Activity.onCreateView(Activity.java:4738)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267) 
        at android.app.Activity.setContentView(Activity.java:1895) 
        at com.byb.tvcel.AoVivoScreen.onCreate(AoVivoScreen.java:14) 
        at android.app.Activity.performCreate(Activity.java:5133) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
        at android.app.ActivityThread.access$600(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:525) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: java.lang.ClassCastException
        at android.app.Fragment.instantiate(Fragment.java:584) 
        at android.app.Fragment.instantiate(Fragment.java:560) 
        at android.app.Activity.onCreateView(Activity.java:4738) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267) 
        at android.app.Activity.setContentView(Activity.java:1895) 
        at com.byb.tvcel.AoVivoScreen.onCreate(AoVivoScreen.java:14) 
        at android.app.Activity.performCreate(Activity.java:5133) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
        at android.app.ActivityThread.access$600(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:525) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
        at dalvik.system.NativeStart.main(Native Method) 
    
asked by anonymous 01.10.2018 / 15:00

0 answers