UPDATE from myself about this: I RESOLVED IT BY MYSELF BY REMOVING "requestWindowFeature(Window.FEATURE_NO_TITLE); " line.
Now I have other queries too related to the same thing. 1. If i want to play my video always in Landscape mode, how to achieve this? 2. If i want to play a video file continuously(play video in looping) even after stopped one cycle, how to achieve it? 3. if i want to remove built-in media player overlay controls such as 'Play', 'Rewind', 'Forward' buttons from the media player which i'm using to play a video file from sdcard on VideoView, how to achieve it? I tried many ways, couldn't be able to resolve the above issues. Could some one if have experience on this resolving it, please share your suggestions with me as i'm new to this development? --- On Sat, 10/17/09, Clave Yard <calvetobediffic...@yahoo.com> wrote: From: Clave Yard <calvetobediffic...@yahoo.com> Subject: [android-beginners] UrgentHelp:Play Video file when accelerometer is triggered code error: To: android-beginners@googlegroups.com Date: Saturday, October 17, 2009, 2:05 AM Hi All, MyTask: I want play a video file in media player or videoview when the device is being shaken(accelerometer triggers). 1. I'm able to get notification whenever accelerometer is triggered on the device using the following code separately. 2. And i'm able to play my video file from sdcard using the following code separately. I'm now integrating both to play my video file when the accelerometer has triggered(whether device moved or shaked or etc). But when it was working both the functionality separately, is not working when i integrated both code to work as per my MyTask. After integrating the code, i tested by shaking my device to observe starting video, but it throws error as "The application has stopped unexpectedly. Please try again'. Can some one please look at my code below and suggest how do improve it and resolve it based on your experince and view? Integrated Code for both Accelerometer access and Playing Video when device is triggered accelerometer: [NOTE: The same code when i executed separately, worked fine for both cases(Accelerometer access and Playing Video)] @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // start motion detection sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); boolean accelSupported = sensorMgr.registerListener(this, SensorManager.SENSOR_ACCELEROMETER, SensorManager.SENSOR_DELAY_GAME); if (!accelSupported) { // on accelerometer on this device sensorMgr.unregisterListener( this, SensorManager.SENSOR_ACCELEROMETER); } } protected void onPause() { if (sensorMgr != null) { sensorMgr.unregisterListener(this, SensorManager.SENSOR_ACCELEROMETER); sensorMgr = null; } super.onPause(); } public void onAccuracyChanged(int arg0, int arg1) { // TODO Auto-generated method stub } public void onSensorChanged(int sensor, float[] values) { Log.d("sensor", "onSensorChanged: " + sensor); if (sensor == SensorManager.SENSOR_ACCELEROMETER) { long curTime = System.currentTimeMillis(); // only allow one update every 100ms. if ((curTime - lastUpdate) > 100) { long diffTime = (curTime - lastUpdate); lastUpdate = curTime; x = values[SensorManager.DATA_X]; y = values[SensorManager.DATA_Y]; z = values[SensorManager.DATA_Z]; float speed = Math.abs(x+y+z - last_x - last_y - last_z) / diffTime * 10000; // WHICH MEANS ACCELEROMETER HAS TRIGGERED .... if (speed > SHAKE_THRESHOLD && enagaged==false) { enagaged=true; Log.d("sensor", "shake detected w/ speed: " + speed); // PLAY VIDEO FILE FROM SDCARD ..... getWindow().setFormat(PixelFormat.TRANSLUCENT); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); myVideo=(VideoView)findViewById(R.id.VideoView01); myVideo.setVideoPath(filename); // filename = "file:///sdcard/myvideo.3gp" mc=new MediaController(this); mc.setMediaPlayer(myVideo); myVideo.setMediaController(mc); myVideo.requestFocus(); } last_x = x; last_y = y; last_z = z; } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---