First, I don't use an emulator because my D270 is not capable of running it, so I just send the .apk of my project to my k012 to try my app out... My VideoView won't play my video entitled 'slideshow' which should play the moment I launched my app... Here are the properties of my video: width: 480, height: 360, framerate: 30fps, length: 32s... my video(slideshow) is located in my res/raw folder... I've tried so many solutions, but it still won't work...

P.S. I'm a newbie :D and thank you

here are my codes: activity_titlepage.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.cookdroid.MainActivity"
tools:ignore="MergeRootFrame" >

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_centerVertical="true"
    android:orientation="vertical" >

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_basicrecipes" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_appetizers" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_soups" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_riceandnoodles" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_fishandshellfish" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_meatandpoultry" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_vegetables" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_desserts" />

    <Button
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:text="@string/btn_drinks" />
</LinearLayout>

<VideoView
    android:id="@+id/videocatplayer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentEnd="true"
    android:layout_alignParentTop="true"
    android:layout_toEndOf="@+id/linearLayout1" 
    />

Recipecategories.java
package com.protosmack.thefoodofthephilippines;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.VideoView;

public class Recipecategories extends Activity {
    VideoView catplayer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_titlepage);
        Uri videosrc=Uri.parse("android.resource://" + getPackageName() + "/raw/slideshow");
        VideoView catplayer= (VideoView) findViewById(R.id.videocatplayer);
        catplayer.setVideoURI(videosrc);
        catplayer.start();
    }
}

Related posts

Recent Viewed