XML is case-sensitive. Your second activity has an <Activity> element, not an <activity> element.
Also, your path to your video file is doubly incorrect. What you have in there now is a reference to a file on your development machine, which is not valid for the emulator or the device. The path you have commented out is a bit closer, but never hardcode /sdcard as a directory, in large part because it is wrong. Use Environment.getExternalStorageDirectory() to get a File object pointing to external storage, and use that to construct a path to your file. On Sun, Dec 12, 2010 at 6:29 AM, vtb <v...@lineone.net> wrote: > New to programming in Android and having trouble launching > a video to play activity. I am pulling what remains of my hair out > so any help or advice would be greatly appreciated as I have tried > all sorts and scanned the net for days bu have not come up > with the answer and I bet it's a simple answer. > > Basically I have a touch screen that is mapped by a file > to give touch areas that select a video to play. All this > mapping and touch code works. > > When I touch an activated area I get the following message:- > > ============================================== > Sorry > The application video_4 (process org.example. > video_4) has stopped unexpectedly. Please try > again. > > Force close. > ============================================== > > When I looked in my book it says if this happens its because > I have not defined my activity in the manifest file. This I > think I have done. > > Here is my manifest file:- > > ==================== > video_4 manifest.xml > ==================== > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="org.example.video_4" > android:versionCode="1" > android:versionName="1.0"> > <application android:icon="@drawable/icon" android:label="@string/ > app_name"> > <activity android:name=".video_4" > android:label="@string/app_name" > android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > > ===========> here is where I think the video activity is defined > > <Activity android:name=".Videos" > android:label="@string/video_play" > android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> > </Activity> > > </application> > <uses-sdk android:minSdkVersion="4" /> > </manifest> > > ================================ > Here is my touch code this works > ================================ > �...@override > public boolean onTouchEvent( MotionEvent event ){ > int xpos,ypos; > > if( event.getAction() != MotionEvent.ACTION_DOWN ){ > return super.onTouchEvent( event ); > } > xpos = (int)event.getX() / 20; > ypos = (int)event.getY() / 20; > if( xpos < 0 || xpos > 39 || ypos < 0 || ypos > 23 || !ready ){ > return true; > } > if( videos_to_play[ ( ypos * 40 ) + xpos ] < 8 ){ > video_to_play = videos_to_play[ ( ypos * 40 ) + xpos ]; > Intent a = new Intent( this , Videos.class ); > startActivity( a ); <====== line that causes the error on > running > } > return true; > } > > ========== > videos.xml > ========== > <?xml version="1.0" encoding="utf-8"?> > <FrameLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="fill_parent" > android:layout_height="fill_parent"> > <VideoView > android:id="@+id/vidview" > android:layout_height="wrap_content" > android:layout_width="wrap_content" > android:layout_gravity="center" > /> > </FrameLayout> > > =========== > videos.java > =========== > package org.example.video_4; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.VideoView; > > public class Videos extends Activity { > > �...@override > protected void onCreate(Bundle savedInstanceState){ > super.onCreate(savedInstanceState); > setContentView( R.layout.videos ); > VideoView video = (VideoView) findViewById( R.id.vidview); > > video.setVideoPath(/*"/LocalDisk/AdBook/v4.mp4"*/"/sdcard/AdBook/ > v4.mp4"); > video.start(); > } > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en