title: No Activity found to handle Intent With ACTION_VIEW Intent
body: <p>i'm bulding a simple app for reproducing video. I do this to lern about the textView. I have completed all but when i would reproduce a video the app crash. I post all the code here.
  This is the MainActivity and is the only activity of the app.</p>
  
  <pre><code>package com.example.movieplayer;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.database.Cursor;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.view.View;
  import android.util.Log;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ListView;
  
  public class MoviePlayerActivity extends Activity 
  implements OnItemClickListener{
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_movie_player);
  
      ArrayList&lt;Movie&gt; movieList = new ArrayList&lt;Movie&gt;();
  
  
      // elenco campi per la query sui media
      String[] mediaColumns = {
              MediaStore.Video.Media._ID, 
              MediaStore.Video.Media.TITLE,
              MediaStore.Video.Media.DURATION,
              MediaStore.Video.Media.DATA,
              MediaStore.Video.Media.MIME_TYPE
              };
  
  
      // elenco campi per la query sui thumbnail
      String[] thumbnailColumns = { MediaStore.Video.Thumbnails.DATA };
  
      // cursore sulle righe risultato
  
  Cursor cursoreMedia = getContentResolver().
          query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                  mediaColumns, null, null, null);
  
      // per ogni riga del risultto
      if ((cursoreMedia != null) &amp;&amp; cursoreMedia.moveToFirst()) {
          do {
              int id = cursoreMedia.getInt(cursoreMedia
                      .getColumnIndex(MediaStore.Video.Media._ID));
  
              Cursor cursoreMiniature = getContentResolver().
                      query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI,
                              thumbnailColumns, MediaStore.Video.Thumbnails.VIDEO_ID
                              + "=" + id, null, null);
  
              // nuovo oggetto per l'arraylist
  
              Movie movie = new Movie(cursoreMedia, cursoreMiniature);
              movieList.add(movie);
  
  
          } while (cursoreMedia.moveToNext());
  
      }
  
      MovieListAdapter movieListAdapter = new MovieListAdapter(this, movieList);
  
      ListView movieListView = (ListView)findViewById(R.id.listView1);
      movieListView.setAdapter(movieListAdapter);
  
      movieListView.setOnItemClickListener(this);     
  
  }
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
      // TODO Auto-generated method stub
  
      Movie movie = (Movie) parent.getAdapter().getItem(position);
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setDataAndType(Uri.parse(movie.getMovieFilePath()), 
                                movie.getMimeType());
      startActivity(intent);
  
  }
  }
  </code></pre>
  
  <p>This is the Movie class.</p>
  
  <pre><code>package com.example.movieplayer;
  
  import android.database.Cursor;
  import android.provider.MediaStore;
  
  class Movie {
  
  private String titolo;
  private String videoFilePath;
  private String mimeType;
  private long durata;
  private String miniaturaFilePath;
  
  public Movie(Cursor mediaCursor, Cursor thumbnailCursor) 
  
  {
      titolo = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE));
      videoFilePath = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.Media.DATA));
      mimeType = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE));
      durata = mediaCursor.getLong(mediaCursor.getColumnIndex(MediaStore.Video.Media.DURATION));
  
      if ((thumbnailCursor != null) &amp;&amp; thumbnailCursor.moveToFirst()) 
          miniaturaFilePath = thumbnailCursor.getString(thumbnailCursor.getColumnIndex(MediaStore.Video.Thumbnails.DATA));
      else
          miniaturaFilePath = null;
  }
  
  public String getTitolo() {
      return titolo;
  }
  
  public String getMovieFilePath() {
      return videoFilePath;
  }
  
  public String getMimeType() {
      return mimeType;
  }
  
  public long getDurata() {
      return durata;
  }
  
  public String getThumbnailFilePath() {
      return miniaturaFilePath;
  }
  
  public String toString() {
      return "Video [title=" + titolo + ", PathFileVideo=" + videoFilePath
              + ", mimeType=" + mimeType + ", durata=" + durata
              + ", thumbnailFilePath=" + miniaturaFilePath + "]";
  
  }
  
  
  }
  </code></pre>
  
  <p>This is the MovieListAdapter </p>
  
  <pre><code>    package com.example.movieplayer;
  
  import java.util.ArrayList;
  import android.annotation.SuppressLint;
  import android.content.Context;
  import android.net.Uri;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.VideoView;
  
  
  @SuppressLint({ "InflateParams", "DefaultLocale" })
  class MovieListAdapter extends BaseAdapter {
  
      private Context context;
      ArrayList&lt;Movie&gt; videoList;
  
      public MovieListAdapter(Context context, ArrayList&lt;Movie&gt; movieList) {
      this.context = context;
      this.videoList = movieList; }
  
  
  
  
  
      @Override
      public int getCount() {
          return videoList.size();
      }
  
      @Override
      public Object getItem(int position) {
          return videoList.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return  position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          if (convertView == null) {
              LayoutInflater layoutInflater =
                      (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = layoutInflater.inflate(R.layout.movie_item, null);
  
  
          }
  
          Movie movie = (Movie) getItem(position);
  
          // thumbnail
          ImageView thumbnail = 
                  (ImageView) convertView.findViewById(R.id.thumbnail);
  
          if (movie.getThumbnailFilePath() != null) {
              thumbnail.setImageURI(Uri.parse(movie.getThumbnailFilePath()));
          } else {
              thumbnail.setImageResource(R.drawable.ic_launcher);
          }
  
          //titolo
          TextView titolo = (TextView) convertView.findViewById(R.id.titolo);
          titolo.setText(movie.getTitolo());
  
          //durata
          TextView durata = (TextView) convertView.findViewById(R.id.durata);
          durata.setText(getDurataAsString(movie.getDurata()));
  
          return convertView;
      }
  
      private static String getDurataAsString(long durata) {
  
          long secondi = durata / 1000;
          long millisecondi = durata % 1000;
  
          long minuti = secondi / 60;
          secondi %= 60;
  
          long ore = minuti / 60;
          minuti %= 60;
  
          String durataString = String.format("%1$02d:%2$02d:%3$02d.%4$03d",
                  ore, minuti, secondi, millisecondi);
  
          return durataString;
      }
  
  }
  </code></pre>
  
  <p>And this is the error that the LogCat give me when the app crash.</p>
  
  <pre><code>  09-08 00:04:42.681: E/AndroidRuntime(9468): FATAL EXCEPTION: main
  09-08 00:04:42.681: E/AndroidRuntime(9468): Process: com.example.movieplayer, PID: 9468
  09-08 00:04:42.681: E/AndroidRuntime(9468): android.content.ActivityNotFoundException: No Activity found to handle Intent   
  
                      { act=android.intent.action.VIEW                        
  
  dat=/storage/sdcard0/dcim/Camera/VID_20150804_193111.mp4 typ=video/mp4 }
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Instrumentation.checkStartActivityResult             
  
          (Instrumentation.java:1776)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Instrumentation.execStartActivity                
  
          (Instrumentation.java:1496)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Activity.startActivityForResult(Activity.java:3801)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Activity.startActivityForResult(Activity.java:3743)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Activity.startActivity(Activity.java:4072)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.Activity.startActivity(Activity.java:4040)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at com.example.movieplayer.MoviePlayerActivity.onItemClick          
  
              (MoviePlayerActivity.java:85)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.widget.AdapterView.performItemClick(AdapterView.java:305)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.widget.AbsListView.performItemClick(AbsListView.java:1185)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:3222)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.widget.AbsListView$3.run(AbsListView.java:4138)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.os.Handler.handleCallback(Handler.java:815)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.os.Handler.dispatchMessage(Handler.java:104)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.os.Looper.loop(Looper.java:194)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at android.app.ActivityThread.main(ActivityThread.java:5578)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at java.lang.reflect.Method.invoke(Native Method)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at java.lang.reflect.Method.invoke(Method.java:372)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run           
  
              (ZygoteInit.java:955)
  09-08 00:04:42.681: E/AndroidRuntime(9468):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
  </code></pre>
  
  <p>Anyone know what is the problem?</p>