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 9115575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:27:55+00:00 2026-06-17T04:27:55+00:00

I have a list view that is populated from an array of items names.

  • 0

I have a list view that is populated from an array of items names. It is set up with List (class) and list_item (layout). Now I set up click listener for listview rows to play video in VideoView which is set up with ClipsActivity (class) activity_clips(layout).

PROBLEM: On clicking the row in ListView next activity(ClipsActivity) loads with the alert “Sorry,this video can not be played”. I have the video files in asset folder for sure. I believe – the problem may lie in the way the string is passed/parsed from the ClickListener to the videoview. Hope someone helps me on this.

Code using for List class

package com.abcdef.list;



//import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
//import android.widget.AdapterView;
//import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
 import android.widget.ListView;
    //import android.widget.TextView;

   public class List extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// storing string resources into Array
String[] clips_files = getResources().getStringArray(R.array.clips_files);

// Binding resources Array to ListAdapter
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, clips_files));
  }   
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
change(position);
  }
void change(int position){
Intent intent = new Intent(getApplicationContext(), ClipsActivity.class);
    switch(position){  

    case 0 :
       intent.setData(Uri.parse("file:///android_asset/A1.mp4"));
        break;
    case 1 :
       intent.setData(Uri.parse("file:///android_asset/A2.mp4"));
        break;
    case 2 :
       intent.setData(Uri.parse("file:///android_asset/A3.mp4"));
        break;

    case 3 :
      intent.setData(Uri.parse("file:///android_asset/A4.mp4"));
        break;
    }
        startActivity(intent);
    }  
}

This is the code using for ClipsActivity class with VideoView

package com.abcde.list;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
import java.net.URI; 


@SuppressWarnings("unused")

public class ClipsActivity extends Activity  {

VideoView mVideoView;
MediaController mc;
// String uriPath;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_clips);
    final VideoView mVideoView = (VideoView)findViewById(R.id.videoview);
     MediaController mc = new MediaController(this);
     mc.setAnchorView(mVideoView);
     mVideoView.setMediaController(mc);


    mVideoView.setVideoPath((getIntent().getDataString()); 
    mVideoView.start(); 
    mVideoView.setOnCompletionListener(
            new MediaPlayer.OnCompletionListener() {
            public void onCompletion(MediaPlayer mp) {
                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-17T04:27:57+00:00Added an answer on June 17, 2026 at 4:27 am

    Instead of accessing from assets,You must copy the video into your project’s res/raw folder. Create raw folder under res folder. It must be in a supported format (3gp, wmv, mp4 ) and named with lower case, numerics, underscores and dots in its filename likewise:video_file.mp4.

    VideoView view = (VideoView)findViewById(R.id.videoView);
    String path = "android.resource://" + getPackageName() + "/" + R.raw.video_file;
    view.setVideoURI(Uri.parse(path));
    view.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a list view that displays the names and dates of items
I have a list view which is populated via records from the database. Now
I have a list view that displays a collection of items, each item has
I have a custom list view that is getting data from server and changing
I have a list view with many rows and have it set so that
I have a ListView with one TextView. List view is populated from a string
Hi I have an array adapter that is populated from an array like so:
In my winforms app, I have a list view control that is populated with
I have a listview that displays player names from a datastore class and i
I have a listView that is populated from a database wich has 22 items.

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.