1. Are you ready for the Galaxy S20? Here is everything we know so far!

VideoView issue.

Discussion in 'Android Development' started by OberSchutze, Dec 19, 2012.

  1. OberSchutze

    OberSchutze Newbie
    Thread Starter

    Hello I am having an issue with a small application that I am making. The APK compiles and I am not receiving any errors, however when I go to open the application up it does not show up in my application list despite it saying it installed.

    Here is my JAVA and XML files.

    [HIGH]package com.AnVideoView;

    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.MediaController;
    import android.widget.VideoView;

    public class AnVideoView extends Activity {

    String SrcPath = "/sdcard/Video/video.mp4";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
    myVideoView.setVideoPath(SrcPath);
    myVideoView.setMediaController(new MediaController(this));
    myVideoView.requestFocus();
    myVideoView.start();
    }
    }[/HIGH]

    XML
    [HIGH]<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="My Video Player"
    />
    <LinearLayout
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
    <VideoView
    android:id="@+id/myvideoview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
    </LinearLayout>
    </LinearLayout>[/HIGH]
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Rwhittaker13

    Rwhittaker13 Lurker

    Hmmm.. this is a tricky bug. I'll study this and if I find something wrong, I will let you know. I am taking programming classes in java and C++, so I'm new to the developing world, but I will be of as much assistance as possible!
     
  3. Rwhittaker13

    Rwhittaker13 Lurker

    I've had a similar issue when I tried installing QPST.apk on my phone. Installed correctly, but it showed as a system app, so it did not show up on my apps list
     
  4. OberSchutze

    OberSchutze Newbie
    Thread Starter

    On a side note, is is possible to embed a mp4 into an application so that the whole thing is self contained?
     
  5. jonbonazza

    jonbonazza Android Expert

    Can you post your manifest file?
     
  6. OberSchutze

    OberSchutze Newbie
    Thread Starter

    [HIGH]<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.AnVideoView"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
    android:name=".AnVideoView"
    android:label="@string/app_name"
    android:configChanges="keyboardHidden|orientation">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    </application>

    </manifest>[/HIGH]
     
  7. OberSchutze

    OberSchutze Newbie
    Thread Starter

    I changed the minsdk to 15 and that seemed to have fixed the problem. Now I want to just have a stop play option without the forward or back and embed the video file into the apk. Is it even possible to embed a mp4 into a apk file?

    EDIT: I was able to embed the video file into the APK, I am still stuck on making the control just have a stop and play button though.
     
Loading...

Share This Page

Loading...