How to make a Video App with Kotlin

Guys i’m trying to make a simples app and I need some help.
My main page is a video background and 3 buttons.
Each button take me to another screen to play the button video.
But when I try to run the button, the app crash.

How could I do it ?

package com.diegokeiti.darwin_final;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.Button;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {

Button bende;
Button escra;
Button expe;



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button bende = findViewById(R.id.bende);
    bende.setOnClickListener(view -> {
        Intent intentb = new Intent(this, bendegoAt.class);
        startActivity(intentb);
    });

    Button escra = findViewById(R.id.escra);
    escra.setOnClickListener(view -> {
        Intent intentes = new Intent(this, escravidaoAt.class);
        startActivity(intentes);
    });

    Button expe = findViewById(R.id.expe);
    expe.setOnClickListener(view -> {
        Intent intentex = new Intent(this, expedicaoAt.class);
        startActivity(intentex);
    });


           //Começo do leitor de video e bg animado
    VideoView mVideoView = (VideoView) findViewById(R.id.BGvideoView);
    Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.menu);
    mVideoView.setVideoURI(uri);
    mVideoView.start();
    mVideoView.setOnPreparedListener(mediaPlayer -> mediaPlayer.setLooping(true));
    // fim do bg
}

}

1 Like

That code is Java

1 Like