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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:13:58+00:00 2026-06-17T23:13:58+00:00

I try to use Android Videoview to play a video in my sdcard. And

  • 0

I try to use Android Videoview to play a video in my sdcard. And it play next video in my sdcard if the sdcard have several videos. But neither in my emulator or my smartphone the app work.

I already add the permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and a video to my sdcard.

Following is my code,

package com.example.videotest;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle ;
import android.provider.MediaStore.Video;
import android.app.Activity;
import android.database.Cursor;
import android.view.Menu;
import android.widget.Toast;
import android.widget.VideoView;

 public class MainActivity extends Activity implements OnCompletionListener{
 Cursor mediaCursor=null;
 VideoView videoView=null;
 int dataIdx=0;
@Override
public void onCompletion(MediaPlayer arg0) {
    // TODO Auto-generated method stub
    playNextVideo();            
}       
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    VideoView videoView=(VideoView) findViewById(R.id.videoView1);
    videoView.setOnCompletionListener((OnCompletionListener) this);
    String projection[]=new String[] {Video.Media.DATA};
    mediaCursor=getContentResolver().query(Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
    if(mediaCursor!=null&&mediaCursor.getCount()>0){
           dataIdx=mediaCursor.getColumnIndex(Video.Media.DATA);
           playNextVideo();
    }
}
private void playNextVideo(){
        mediaCursor.moveToNext();
        if(mediaCursor.isAfterLast()){ 
            Toast.makeText(getApplicationContext(),"End of Line",Toast.LENGTH_SHORT).show();
        }
        else{
                String path=mediaCursor.getString(dataIdx);
                Toast.makeText(getApplicationContext(),"playing: "+path, Toast.LENGTH_SHORT).show();
                videoView.setVideoPath(path);
                videoView.start();
        }
}



@Override
public void onDestroy(){
     if (mediaCursor!=null){
         mediaCursor.close();
     }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
}



 01-29 10:43:39.186: W/WindowManager(161): Failure taking screenshot for (246x410) to layer 21015
 01-29 10:43:39.256: I/Choreographer(429): Skipped 32 frames!  The application may be doing too much work on its main thread.
 01-29 10:43:39.535: I/Choreographer(429): Skipped 59 frames!  The application may be doing too much work on its main thread.
 01-29 10:44:03.995: D/AndroidRuntime(1345): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
 01-29 10:44:03.995: D/AndroidRuntime(1345): CheckJNI is ON
 01-29 10:44:04.035: D/dalvikvm(1345): Trying to load lib libjavacore.so 0x0
 01-29 10:44:04.045: D/dalvikvm(1345): Added shared lib libjavacore.so 0x0
 01-29 10:44:04.075: D/dalvikvm(1345): Trying to load lib libnativehelper.so 0x0
 01-29 10:44:04.075: D/dalvikvm(1345): Added shared lib libnativehelper.so 0x0
 01-29 10:44:04.895: D/AndroidRuntime(1345): Calling main entry com.android.commands.pm.Pm
 01-29 10:44:04.965: W/ActivityManager(161): No content provider found for permission revoke: file:///data/local/tmp/VideoTEST.apk
 01-29 10:44:04.985: W/ActivityManager(161): No content provider found for permission revoke: file:///data/local/tmp/VideoTEST.apk
 01-29 10:44:05.266: D/dalvikvm(161): GC_CONCURRENT freed 550K, 45% free 10453K/18887K, paused 19ms+27ms, total 148ms
 01-29 10:44:05.326: I/PackageManager(161): Removing non-system package:com.example.videotest
 01-29 10:44:05.326: I/ActivityManager(161): Force stopping package com.example.videotest uid=10044
 01-29 10:44:05.326: I/ActivityManager(161): Killing proc 1282:com.example.videotest/u0a44: force stop
 01-29 10:44:05.326: W/ActivityManager(161): Force removing ActivityRecord{416c3d88 com.example.videotest/.MainActivity}: app died, no saved state
 01-29 10:44:05.376: W/InputDispatcher(161): channel '416195c8 com.example.videotest/com.example.videotest.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
 01-29 10:44:05.376: E/InputDispatcher(161): channel '416195c8 com.example.videotest/com.example.videotest.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
 01-29 10:44:05.386: I/WindowState(161): WIN DEATH: Window{416195c8 com.example.videotest/com.example.videotest.MainActivity paused=false}
 01-29 10:44:05.386: W/InputDispatcher(161): Attempted to unregister already unregistered input channel '416195c8 com.example.videotest/com.example.videotest.MainActivity (server)'
 01-29 10:44:05.386: W/WindowManager(161): Force-removing child win Window{4167b698 SurfaceView paused=false} from container Window{416195c8 com.example.videotest/com.example.videotest.MainActivity paused=false}
 01-29 10:44:05.426: W/WindowManager(161): Failed looking up window
 01-29 10:44:05.426: W/WindowManager(161): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4161c220 does not exist
 01-29 10:44:05.426: W/WindowManager(161):  at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7640)
   01-29 10:44:05.426: W/WindowManager(161):    at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7631)
   01-29 10:44:05.426: W/WindowManager(161):    at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:854)
  01-29 10:44:05.426: W/WindowManager(161):     at android.os.BinderProxy.sendDeathNotice(Binder.java:449)
  01-29 10:44:05.426: W/WindowManager(161):     at dalvik.system.NativeStart.run(Native Method)
  01-29 10:44:05.426: I/WindowState(161): WIN DEATH: null
  01-29 10:44:05.426: I/WindowManager(161): WINDOW DIED Window{416195c8 co m.example.videotest/com.example.videotest.MainActivity paused=false}
  01-29 10:44:05.666: W/InputMethodManagerService(161): Got RemoteException sending setActive(false) notification to pid 1282 uid 10044
   01-29 10:44:06.095: I/PackageManager(161): Package com.example.videotest codePath changed from /data/app/com.example.videotest-1.apk to /data/app/com.example.videotest-2.apk; Retaining data and using new
     01-29 10:44:06.095: I/PackageManager(161): Running dexopt on: com.example.videotest
     01-29 10:44:06.965: D/dalvikvm(1356): DexOpt: load 131ms, verify+opt 486ms, 745428 bytes
    01-29 10:44:06.986: I/ActivityManager(161): Force stopping package com.example.videotest uid=10044
  01-29 10:44:06.995: W/PackageManager(161): Code path for pkg : com.example.videotest changing from /data/app/com.example.videotest-1.apk to /data/app/com.example.videotest-2.apk
  01-29 10:44:06.995: W/PackageManager(161): Resource path for pkg : com.example.videotest changing from /data/app/com.example.videotest-1.apk to /data/app/com.example.videotest-2.apk
  01-29 10:44:07.115: D/PackageManager(161): New package installed in /data/app/com.example.videotest-2.apk
  01-29 10:44:07.236: I/ActivityManager(161): Force stopping package com.example.videotest uid=10044
  01-29 10:44:07.246: D/dalvikvm(429): WAIT_FOR_CONCURRENT_GC blocked 0ms
  01-29 10:44:07.286: D/dalvikvm(616): WAIT_FOR_CONCURRENT_GC blocked 0ms
  01-29 10:44:07.436: D/dalvikvm(429): GC_EXPLICIT freed 10435K, 60% free 8931K/21831K, paused 11ms+23ms, total 186ms
  01-29 10:44:07.446: D/dalvikvm(540): WAIT_FOR_CONCURRENT_GC blocked 0ms
  01-29 10:44:07.466: D/dalvikvm(616): GC_EXPLICIT freed 4569K, 37% free 10401K/16455K, paused 7ms+33ms, total 179ms
  01-29 10:44:07.666: I/InputReader(161): Reconfiguring input devices.  changes=0x00000010
  01-29 10:44:07.676: D/PackageManager(161): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
   01-29 10:44:07.686: D/dalvikvm(540): GC_EXPLICIT freed 86K, 7% free 8394K/8967K, paused 12ms+8ms, total 218ms
   01-29 10:44:07.745: I/AccountTypeManager(710): Loaded meta-data for 1 account types, 0 accounts in 63ms(wall) 6ms(cpu)
   01-29 10:44:07.745: D/PackageManager(161): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
   01-29 10:44:07.755: D/BackupManagerService(161): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.videotest flg=0x8000010 (has extras) }
   01-29 10:44:07.865: D/dalvikvm(161): GC_CONCURRENT freed 564K, 45% free 10429K/18887K, paused 53ms+13ms, total 188ms
   01-29 10:44:07.865: D/dalvikvm(161): WAIT_FOR_CONCURRENT_GC blocked 109ms
   01-29 10:44:08.035: D/dalvikvm(161): GC_EXPLICIT freed 61K, 46% free 10369K/18887K, paused 13ms+29ms, total 166ms
   01-29 10:44:08.135: I/ActivityManager(161): Start proc com.android.keychain for broadcast com.android.keychain/.KeyChainBroadcastReceiver: pid=1357 uid=1000 gids={1015, 3002, 3001, 3003, 1028}
     01-29 10:44:08.226: D/PackageManager(161): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
     01-29 10:44:08.256: D/PackageManager(161): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
     01-29 10:44:08.285: I/InputReader(161): Reconfiguring input devices.  changes=0x00000010
   01-29 10:44:08.296: D/BackupManagerService(161): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.videotest flg=0x8000010 (has extras) }
     01-29 10:44:08.296: V/BackupManagerService(161): removePackageParticipantsLocked: uid=10044 #1
      01-29 10:44:08.515: V/BackupManagerService(161): addPackageParticipantsLocked: #1
     01-29 10:44:08.556: W/InputMethodManagerService(161): Found no subtypes in a system IME: com.android.inputmethod.pinyin
      01-29 10:44:08.586: E/Trace(1357): error opening trace file: No such file or directory (2)
   01-29 10:44:08.686: I/AccountTypeManager(710): Loaded meta-data for 1 account types, 0 accounts in 9ms(wall) 5ms(cpu)
    01-29 10:44:08.796: D/dalvikvm(161): WAIT_FOR_CONCURRENT_GC blocked 0ms
      01-29 10:44:08.975: W/RecognitionManagerService(161): no available voice recognition services found
    01-29 10:44:09.146: D/dalvikvm(161): GC_EXPLICIT freed 367K, 45% free 10413K/18887K, paused 57ms+22ms, total 355ms
  01-29 10:44:09.186: D/AndroidRuntime(1345): Shutting down VM
  01-29 10:44:09.196: D/dalvikvm(1345): GC_CONCURRENT freed 101K, 78% free 458K/2048K, paused 1ms+2ms, total 12ms
       01-29 10:44:09.206: D/jdwp(1345): Got wake-up signal, bailing out of select
      01-29 10:44:09.206: D/dalvikvm(1345): Debugger has detached; object registry had 1 entries
     01-29 10:44:09.206: I/AndroidRuntime(1345): NOTE: attach of thread 'Binder_3' failed
      01-29 10:44:10.085: D/AndroidRuntime(1377): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
      01-29 10:44:10.085: D/AndroidRuntime(1377): CheckJNI is ON
     01-29 10:44:10.176: D/dalvikvm(1377): Trying to load lib libjavacore.so 0x0
     01-29 10:44:10.186: D/dalvikvm(1377): Added shared lib libjavacore.so 0x0
     01-29 10:44:10.246: D/dalvikvm(1377): Trying to load lib libnativehelper.so 0x0
     01-29 10:44:10.246: D/dalvikvm(1377): Added shared lib libnativehelper.so 0x0
    01-29 10:44:11.126: D/AndroidRuntime(1377): Calling main entry com.an droid.commands.am.Am
     01-29 10:44:11.156: I/ActivityManager(161): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.videotest/.MainActivity u=0} from pid 1377
     01-29 10:44:11.186: W/WindowManager(161): Failure taking screenshot for (246x410) to    layer 21005
     01-29 10:44:11.226: D/AndroidRuntime(1377): Shutting down VM
     01-29 10:44:11.246: I/AndroidRuntime(1377): NOTE: attach of thread 'Binder_3' failed
     01-29 10:44:11.246: D/dalvikvm(1377): GC_CONCURRENT freed 102K, 77% free 489K/2048K, paused 11ms+1ms, total 23ms
    01-29 10:44:11.256: D/jdwp(1377): Got wake-up signal, bailing out of select
     01-29 10:44:11.256: D/dalvikvm(1377): Debugger has detached; object registry had 1 entries
      01-29 10:44:11.266: D/dalvikvm(1388): Not late-enabling CheckJNI (already on)
     01-29 10:44:11.286: I/ActivityManager(161): Start proc com.example.videotest for activity com.example.videotest/.MainActivity: pid=1388 uid=10044 gids={1015, 1028}
     01-29 10:44:11.705: E/Trace(1388): error opening trace file: No such file or directory (2)
     01-29 10:44:12.256: D/dalvikvm(161): WAIT_FOR_CONCURRENT_GC blocked 0ms
     01-29 10:44:12.406: D/dalvikvm(161): GC_EXPLICIT freed 110K, 45% free 10473K/18887K, paused 10ms+12ms, total 157ms
     01-29 10:44:12.606: I/Choreographer(1388): Skipped 38 frames!  The application may be doing too much work on its main thread.
     01-29 10:44:12.685: D/gralloc_goldfish(1388): Emulator without GPU emulation detected.
     01-29 10:44:12.755: I/ActivityManager(161): Displayed com.example.videotest/.MainActivity: +1s541ms
     01-29 10:44:13.146: I/Choreographer(1388): Skipped 92 frames!  The application may be doing too much work on its main thread.
     01-29 10:48:55.096: E/ThrottleService(161): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
      01-29 10:50:28.105: D/dalvikvm(457): GC_CONCURRENT freed 403K, 7% free 8578K/9159K, paused 17ms+4ms, total 57ms
  • 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-17T23:13:59+00:00Added an answer on June 17, 2026 at 11:13 pm

    In your onCreate() method

    This line

        VideoView videoView=(VideoView) findViewById(R.id.videoView1);
    

    Should be

        videoView=(VideoView) findViewById(R.id.videoView1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android application that uses a VideoView to play videos and I
hello i try to use simple application in android but i have many problems
Do I have to install facebook.apk on my android device before try to use
I try to use wilcards in Android.mk with help of this answer https://stackoverflow.com/a/8459242/1039175 But
I try to use reinstall a application that I made in android. but, istalliation
I try to use FlushedInputStream : Android decoder->decode returned false for Bitmap download but
Each time when I try to use emulator's camera in video capturing mode -
I was installing android sdk but when I try to use the sdk manager
I try to run my project in windows. Project use android ndk. I install
I try use string as a regular expression pattern but I've following errors PHP

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.