Hi, i am using one activity and videoview inside it, and playing 2 videos. on start it plays first video and then an activity containing text- view will come, then on tap it will play the 2nd video. i m pssing the name of the videofile2, from the text activity,and playing the video.
but i m getting outofmemory error. please let me know how can i release the objects of videoviews.because i m playing 2 videos in one activity.. my code is************ package com.syne.marlboroblackmentholpromotionalapp; import java.util.WeakHashMap; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.Toast; import android.widget.VideoView; /** * * @author Atikurrahiman.Jamadar plays the video redirects to another activity. * */ public class PlayVideoActivity extends Activity { /** * TODO: Set the path variable to a streaming video URL or a local media * file path. */ private String path = "qqq"; private VideoView mVideoView; Intent intent; String filename = null; private boolean flag; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.playvideoactivity); Log.i("playcar vdo2" + getClass().getName(), "before"); mVideoView = (VideoView) findViewById(R.id.surface_view); Log.i("playcar vdo2" + getClass().getName(), "after"); intent = getIntent(); filename = intent.getStringExtra("video2"); Log.i("playcar vdo2 second time" + getClass().getName(), "filename " + filename); if (path == "") { // Tell the user to provide a media file URL/path. Toast.makeText( PlayVideoActivity.this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show(); } else { int vidfileID; if (filename == null) { flag = true; vidfileID = getResources().getIdentifier("aa", "raw", getPackageName()); } else { vidfileID = getResources().getIdentifier(filename, "raw", getPackageName()); flag = false; } Uri uri = Uri .parse("android.resource:// com.syne.marlboroblackmentholpromotionalapp/" + vidfileID); mVideoView.setVideoURI(uri); // mVideoView.setMediaController(new MediaController(this)); mVideoView.requestFocus(); mVideoView.setVideoURI(uri); mVideoView.start(); mVideoView .setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // when video ends image sequence activity will be // called. if(mp != null) { mp.release(); } if (flag == true) { Intent i = new Intent(); i.setClass(getApplicationContext(), ImageSequenceActivity.class); startActivity(i); finish(); } else if (flag == false) { RelativeLayout videolayout = (RelativeLayout) findViewById(R.id.videolayout); Button btnrestart = (Button) findViewById(R.id.btnrestart); videolayout .setBackgroundResource(R.drawable.last); btnrestart.setVisibility(View.VISIBLE); mVideoView.setVisibility(View.INVISIBLE); btnrestart .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(); i.setClass( getApplicationContext(), FadeImageActivity.class); i.putExtra("first", false); startActivity(i); finish(); } }); } } }); } } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); } } -- 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