title: ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///mnt/sdcard/testdata5.pdf
body: <p>I have a requirement to display pdf file from SD card. This pdf file is created after a network operation. I'm getting <code>ActivityNotFoundException</code> when trying to open pdf through <code>activity.startActivity(intent);</code> . Below is code
  <strong>folder_list_details.xml</strong></p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
   &lt;ListView 
      android:layout_height="wrap_content"
      android:layout_width="fill_parent" android:id="@+id/listV_main"/&gt;
  &lt;ImageView 
      android:id="@+id/photo"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingRight="15dp"
      android:paddingTop="10dp" /&gt;
          &lt;TextView android:id="@+id/name"
      android:textSize="14sp" 
      android:textStyle="bold" 
      android:textColor="#000000" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"
      android:layout_toRightOf="@id/photo"/&gt;
  
        &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>FolderActivity.java</strong></p>
  
  <pre><code>    public class FolderListActivity extends ListActivity{
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      Log.i("FolderListActivity", "onCreate" );
      FolderDisplay folderObj = new FolderDisplay(FolderListActivity.this);
      folderObj.execute((Void) null);
       }
      } 
  </code></pre>
  
  <p><strong>FolderDisplay.java</strong> :  </p>
  
  <pre><code>     @Override
         protected void onPostExecute(Void v) {
      try{
                  //activity is an  instance of FolderListActivity
          final ListView lv1 =activity.getListView(); 
          lv1.setOnItemClickListener(new OnItemClickListener() {
              @Override
        public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position,long id) {                           
              File file =Utility.getInstance().getFile();
                  Intent intent = new Intent(Intent.ACTION_VIEW);
                   intent.setDataAndType(Uri.fromFile(file), "application/pdf");
                   intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    activity.startActivity(intent);
              }  
          });
      }catch(Exception e){
          }
   }
  </code></pre>
  
  <p><strong>Mainfest.xml</strong></p>
  
  <pre><code>                  &lt;?xml version="1.0" encoding="utf-8"?&gt;
               &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
             package="com.example.testlogin"
             android:versionCode="1"
               android:versionName="1.0" &gt;
  
        &lt;uses-sdk
         android:minSdkVersion="11"
       android:targetSdkVersion="17" /&gt;
         &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
       &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"&gt;
         &lt;/uses-  permission&gt;
  
        &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" 
      android:debuggable="true"
      &gt;
      &lt;activity
          android:name="com.example.testlogin.LoginActivity"
          android:label="@string/app_name"
          android:windowSoftInputMode="adjustResize|stateVisible" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
        &lt;/activity&gt;
          &lt;activity
          android:name="com.example.testlogin.RepoListActivity"
          android:label="@string/title_activity_repo_list" &gt;
         &lt;/activity&gt;
         &lt;activity
          android:name="com.example.testlogin.FolderListActivity"
          android:label="@string/title_activity_folder_list" &gt;
        &lt;/activity&gt;
       &lt;/application&gt;
  
       &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Error</strong> I'm getting </p>
  
  <pre><code>android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///mnt/sdcard/Alfdata/testdata5.pdf typ=application/pdf flg=0x4000000 }
  </code></pre>