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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:58:04+00:00 2026-05-27T10:58:04+00:00

I am making an application in android. in first activity its displays list of

  • 0

I am making an application in android. in first activity its displays list of videos and that are on youtube…

But, when i click that list and control transfer to the next activity and I am transferring URL of that video to the next activity. Every thing is working correct but video is not displaying… I am using video view control. But When I see LogCat File, Following errors displays to me…

I written permission of internet to my manifest file

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

But still got error.( Application doesn’t display error)

LOGCAT:

12-09 21:13:10.905: V/VideoViewDemo(2559): path: http://www.youtube.com/watch?v=i5Fsnv6wHJo
12-09 21:13:12.865: E/VideoViewDemo(2559): error: Permission denied
12-09 21:13:12.865: E/VideoViewDemo(2559): java.io.IOException: Permission denied
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.io.File.createNewFileImpl(Native Method)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.io.File.createNewFile(File.java:1257)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.io.File.createTempFile(File.java:1322)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.io.File.createTempFile(File.java:1278)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.pxr.tutorial.xmltest.Watch_Video.getDataSource(Watch_Video.java:180)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.pxr.tutorial.xmltest.Watch_Video.playVideo(Watch_Video.java:157)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.pxr.tutorial.xmltest.Watch_Video.access$0(Watch_Video.java:141)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.pxr.tutorial.xmltest.Watch_Video$5.run(Watch_Video.java:135)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.Activity.runOnUiThread(Activity.java:3717)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.pxr.tutorial.xmltest.Watch_Video.onCreate(Watch_Video.java:133)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.os.Looper.loop(Looper.java:123)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at android.app.ActivityThread.main(ActivityThread.java:3683)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.lang.reflect.Method.invokeNative(Native Method)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at java.lang.reflect.Method.invoke(Method.java:507)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-09 21:13:12.865: E/VideoViewDemo(2559):  at dalvik.system.NativeStart.main(Native Method)

Code for main file:

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listplaceholder);

    String str=getIntent().getExtras().getString("Category").toString();

    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();


    String xml = XMLfunctions.getXML(str);
    Document doc = XMLfunctions.XMLfromString(xml);

    int numResults = XMLfunctions.numResults(doc);

    if((numResults <= 0)){
        Toast.makeText(CategoryDetail.this, "Geen resultaten gevonden", Toast.LENGTH_LONG).show();  
        finish();
    }

    NodeList nodes = doc.getElementsByTagName("video1");

    for (int i = 0; i < nodes.getLength(); i++) {                           
        HashMap<String, String> map = new HashMap<String, String>();    

        Element e = (Element)nodes.item(i);
        map.put("iVid", XMLfunctions.getValue(e, "iVid"));
        map.put("vVName", XMLfunctions.getValue(e, "vVName"));
        map.put("vSource", XMLfunctions.getValue(e, "vSource"));

        mylist.add(map);            
    }       

    ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.category_detail, 
                    new String[] { "vVName" }, 
                    new int[] { R.id.item_title });



    setListAdapter(adapter);

    final ListView lv = getListView();
    lv.setTextFilterEnabled(true);  
    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
            @SuppressWarnings("unchecked")
            HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
            //Toast.makeText(CategoryDetail.this, "Video '" + o.get("vVName") + "' is just clicked.", Toast.LENGTH_LONG).show();

            Intent intent=new Intent(CategoryDetail.this, Watch_Video.class);

            intent.putExtra("url", o.get("vSource"));
            startActivity(intent);
            //Toast.makeText(CategoryDetail.this,"This is Url" + o.get("vSource"), Toast.LENGTH_LONG).show();

            //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=nLJYkat4HpE"));
            //startActivity(intent);


        }       

    });
    }

Second Activity File:

    mVideoView = (VideoView) findViewById(R.id.surface_view);

    mPath=getIntent().getExtras().getString("url");
    //mPath = (EditText) findViewById(R.id.path);
    //mPath.setText("http://daily3gp.com/vids/747.3gp");
    Toast.makeText(Watch_Video.this,"This is Url" + mPath.toString(), Toast.LENGTH_LONG).show();

    mPlay = (ImageButton) findViewById(R.id.play);
    mPause = (ImageButton) findViewById(R.id.pause);
    mReset = (ImageButton) findViewById(R.id.reset);
    mStop = (ImageButton) findViewById(R.id.stop);

    mPlay.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            playVideo();
        }
    });
    mPause.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            if (mVideoView != null) {
                mVideoView.pause();
            }
        }
    });
    mReset.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            if (mVideoView != null) {
                mVideoView.seekTo(0);
            }
        }
    });
    mStop.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            if (mVideoView != null) {
                current = null;
                mVideoView.stopPlayback();
            }
        }
    });
    runOnUiThread(new Runnable(){
        public void run() {
            playVideo();

        }});

}

private void playVideo() {
    try {
        final String path = mPath.toString();
        Log.v(TAG, "path: " + path);
        if (path == null || path.length() == 0) {
            Toast.makeText(Watch_Video.this, "File URL/path is empty",
                    Toast.LENGTH_LONG).show();

        } else {
            // If the path has not changed, just start the media player
            if (path.equals(current) && mVideoView != null) {
                mVideoView.start();
                mVideoView.requestFocus();
                return;
            }
            current = path;
            mVideoView.setVideoPath(getDataSource(path));
            mVideoView.start();
            mVideoView.requestFocus();

        }
    } catch (Exception e) {
        Log.e(TAG, "error: " + e.getMessage(), e);
        if (mVideoView != null) {
            mVideoView.stopPlayback();
        }
    }
}

private String getDataSource(String path) throws IOException {
    if (!URLUtil.isNetworkUrl(path)) {
        return path;
    } else {
        URL url = new URL(path);
        URLConnection cn = url.openConnection();
        cn.connect();
        InputStream stream = cn.getInputStream();
        if (stream == null)
            throw new RuntimeException("stream is null");
        File temp = File.createTempFile("mediaplayertmp", "dat");
        temp.deleteOnExit();
        String tempPath = temp.getAbsolutePath();
        FileOutputStream out = new FileOutputStream(temp);
        byte buf[] = new byte[128];
        do {
            int numread = stream.read(buf);
            if (numread <= 0)
                break;
            out.write(buf, 0, numread);
        } while (true);
        try {
            stream.close();
        } catch (IOException ex) {
            Log.e(TAG, "error: " + ex.getMessage(), ex);
        }
        return tempPath;
    }
  • 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-05-27T10:58:05+00:00Added an answer on May 27, 2026 at 10:58 am

    Try to add the following permission to your manifest file:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an android application that shows a list with users, I would
I'm making an application that contains button's and those buttons control an embedded browser.
I'm making an ecommerce application on Android and, as it is my first serious
I want to start making cellphone apps with Android as first choice but not
I'm making an Android application that reads an XML Internet. This application uses SAX
I am making an android application that will play an mp3 file once a
I'm in the process of making an Android application that creates a new file
I am making an application that displays a picture of a room. When the
i am making one application in Android 2.2 in that application i want to
I'm making an application for Android that needs to react to when the device

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.