Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7879253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:51:39+00:00 2026-06-03T03:51:39+00:00

Im implementing a video playback in android im completely new to android, and this

  • 0

Im implementing a video playback in android im completely new to android, and this is the bit of code i have gathered so far.

according to the logic it should play a video. don’t know where im doing wrong.

package com.themetanoia.readfilefromsdc;

import java.io.File;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import android.widget.AdapterView.OnItemClickListener;

public class ReadFileFromSDCActivity extends ListActivity {
    /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

        //Get the file path for external storage
        String a = Environment.getExternalStorageDirectory().getAbsolutePath();
        final String finalPath = a+"/Videos";
        //Define new file function
        File f=new File(finalPath);

        if(f.isDirectory()){              
        //Define arrayadapter
            setListAdapter(new ArrayAdapter<String>(this, R.layout.listview,files));
           //Define listview
            ListView listview = getListView();
            listview.setTextFilterEnabled(true);

           //Onclick list item event
            listview.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {


                    //get selected items
                    String selectedValue = (String) getListAdapter().getItem(position);         
                    Uri uri =  Uri.parse(finalPath);

                    MediaController mediaController = new MediaController(getBaseContext());
                    mediaController.setAnchorView(mVideoView);

                    Uri video = Uri.parse(finalPath+"/"+selectedValue);
                    mVideoView.setMediaController(mediaController);
                    mVideoView.setVideoURI(video);
                    mVideoView.start();

                }


            });             

        }



}


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:51:40+00:00Added an answer on June 3, 2026 at 3:51 am
    <VideoView
      android:id="@+id/videoView1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
       />
    
    
    VideoView vv = (VideoView) findViewById(R.id.videoView1);
    uri = "your video uri";
    vv.setVideoURI(Uri.parse(uri));
    vv.start();
    
    vv.setOnCompletionListener(new OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
               finish();
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any docs/guides/code samples on implementing an SIP based IP or video
implementing publishActivity in PHP using the REST API using this code: $activity = array(
I'm implementing a custom video player because I need custom video controls. I have
Here I am new to Silverlight and I have to implement a video player
n00b here (first Android project). I have been given a custom video codec that
ffdshow has this awesome little API for controlling playback of video files. It allows
I'm implementing a video website with Dailymotion Cloud and plupload (HTML5 runtime). The workflow
Hey, I'm currently looking for various methods of implementing collision response in 2D video
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
When implementing the Strategy Pattern, where does one put the code that determines which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.