Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java VideoView没有响应,Eclipse Android_Java_Android_Android Videoview - Fatal编程技术网

Java VideoView没有响应,Eclipse Android

Java VideoView没有响应,Eclipse Android,java,android,android-videoview,Java,Android,Android Videoview,我正在编写一个应用程序,上面有4个视频,当我播放第一个视频时一切正常,但当我尝试播放第二个视频时,它说应用程序意外停止,我正在使用2个活动中的一些代码。我没有发现任何错误,这是我的第一个程序,非常感谢你提前 我把代码放在下面: 布局Xml:primeraventana.Xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res

我正在编写一个应用程序,上面有4个视频,当我播放第一个视频时一切正常,但当我尝试播放第二个视频时,它说应用程序意外停止,我正在使用2个活动中的一些代码。我没有发现任何错误,这是我的第一个程序,非常感谢你提前 我把代码放在下面:

布局Xml:primeraventana.Xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
 android:id="@+id/textview1"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Escala_Uno" />

<VideoView
 android:id="@+id/videoView1"
 android:layout_width="match_parent"
 android:layout_height="254dp" />

<Button
 android:id="@+id/boton3"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Menú_Principal" />

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView 
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Escala_Dos"/>

 <VideoView
 android:id="@+id/videoView2"
 android:layout_width="match_parent"
 android:layout_height="254dp" />

 <Button 
 android:id="@+id/boton4"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Menú_Principal"/>


 </LinearLayout>
布局Xml::segundaventana.Xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
 android:id="@+id/textview1"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Escala_Uno" />

<VideoView
 android:id="@+id/videoView1"
 android:layout_width="match_parent"
 android:layout_height="254dp" />

<Button
 android:id="@+id/boton3"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Menú_Principal" />

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView 
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Escala_Dos"/>

 <VideoView
 android:id="@+id/videoView2"
 android:layout_width="match_parent"
 android:layout_height="254dp" />

 <Button 
 android:id="@+id/boton4"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/Menú_Principal"/>


 </LinearLayout>
雄激素单

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

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".PruebaNumero3"
        android:label="@string/title_activity_prueba_numero3" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".primeraventana"/>
    <activity android:name=".segundaventana" />
    <activity android:name=".terceraventana" />
    <activity android:name=".cuartaventana" />
    <activity android:name=".VideoActivity"
              android:label="@string/app_name"
              android:screenOrientation="landscape"
              android:theme="@android:style/Theme.NoTitleBar"
              android:noHistory="true"/>
</application>

</manifest>

您的问题在于:

Setting the layout:



public class segundaventana extends Activity  {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.primeraventana);-------------------------> Here lies your problem
改为:

public class segundaventana extends Activity  {

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.segundaventana);---------------------->this layout contains your videoview2

尝试并说..

请检查您正在播放的视频格式….嘿,谢谢,视频格式是MP4Hey!非常感谢:)问题解决了,这是个愚蠢的问题,还有一些低上限,非常感谢你我的解决方案是解决了你的问题还是你找到了其他的解决方案??嘿,伙计,是的,你的解决方案解决了问题非常感谢:)