Android error Log File : permission denied
<p>I am making an application in android. in first activity its displays list of videos and that are on youtube... </p>

<p>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...</p>

<p>I written permission of internet to my manifest file</p>

<pre><code> &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
</code></pre>

<p>But still got error.( Application doesn't display error)</p>

<p><strong>LOGCAT:</strong></p>

<pre><code>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></pre>

<p>Code for main file:</p>

<pre><code>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&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();


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

    int numResults = XMLfunctions.numResults(doc);

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

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

    for (int i = 0; i &lt; nodes.getLength(); i++) {                           
        HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();    

        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&lt;?&gt; parent, View view, int position, long id) {              
            @SuppressWarnings("unchecked")
            HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) 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);


        }       

    });
    }
</code></pre>

<p>Second Activity File:</p>

<pre><code>    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) &amp;&amp; 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 &lt;= 0)
                break;
            out.write(buf, 0, numread);
        } while (true);
        try {
            stream.close();
        } catch (IOException ex) {
            Log.e(TAG, "error: " + ex.getMessage(), ex);
        }
        return tempPath;
    }
</code></pre>
