title: Downloading a text file using Intent from FTP Server.
body: <p>I am downloading a text file from server using ftp connection.
  But unfortunetly I am getting exception: </p>
  
  <pre><code>android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK dat=64.78.178.19 typ=vnd.android.cursor.dir/lysesoft.andftp.uri (has extras) }
  </code></pre>
  
  <p>I have defined activity in manifest.xml also.</p>
  
  <p>below is my <em>manifest file</em></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.saltriver.hourdoc"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk android:minSdkVersion="8" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
  
  &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name"&gt;
      &lt;activity android:name=".HourdocActivity"
                android:label="@string/app_name"&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;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p><em>code to download text file.</em></p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
     Button downloadFilesButton = (Button) findViewById(R.id.button_download_files_id);
      downloadFilesButton.setOnClickListener(new View.OnClickListener()
      {
    public void onClick(View v) 
    {
      Intent intent = new Intent();
      intent.setAction(Intent.ACTION_PICK);
      // FTP URL (Starts with ftp://, sftp://, ftps:// or scp:// followed by hostname and port).
      Uri ftpUri = Uri.parse(ConstantCodes.ftphost);
      intent.setDataAndType(ftpUri, ConstantCodes.ftpuri);
      // Download
      intent.putExtra("command_type", "download");
      // FTP credentials (optional)
      intent.putExtra("ftp_username", ConstantCodes.userid);
      intent.putExtra("ftp_password", ConstantCodes.pwd);
      //intent.putExtra("ftp_keyfile", "/sdcard/dsakey.txt");
      //intent.putExtra("ftp_keypass", "optionalkeypassword");
      // FTP settings (optional)
      intent.putExtra("ftp_pasv", "true");
      //intent.putExtra("ftp_resume", "true");
      //intent.putExtra("ftp_encoding", "UTF-8");
      //intent.putExtra("ftps_mode", "implicit");
      // Activity title
      intent.putExtra("progress_title", "Downloading files ...");
      // Remote files to download.
      intent.putExtra("remote_file1",  ConstantCodes.ftp_remotefile1);
      //intent.putExtra("remote_file2", "/remotefolder/subfolder/file2.zip");
      // Target local folder where files will be downloaded.
      intent.putExtra("local_folder",  ConstantCodes.localfolder_path);  
      intent.putExtra("close_ui", "true");  
      startActivityForResult(intent,ConstantCodes.DOWNLOAD_FILES_REQUEST);
    }
      });
  }
  
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) 
   {
  Log.i(TAG, "Result: "+resultCode+ " from request: "+requestCode);
  if (intent != null)
  {
    String transferredBytesStr = intent.getStringExtra("TRANSFERSIZE");
    String transferTimeStr = intent.getStringExtra("TRANSFERTIME");
    Log.i(TAG, "Transfer status: " + intent.getStringExtra("TRANSFERSTATUS"));
    Log.i(TAG, "Transfer amount: " + intent.getStringExtra("TRANSFERAMOUNT") + " file(s)");
    Log.i(TAG, "Transfer size: " + transferredBytesStr + " bytes");
    Log.i(TAG, "Transfer time: " + transferTimeStr + " milliseconds");
    // Compute transfer rate.
    if ((transferredBytesStr != null) &amp;&amp; (transferTimeStr != null))
    {
      try
      {
        long transferredBytes = Long.parseLong(transferredBytesStr);
        long transferTime = Long.parseLong(transferTimeStr);
        double transferRate = 0.0;
        if (transferTime &gt; 0) transferRate = ((transferredBytes) * 1000.0) / (transferTime * 1024.0);
        Log.i(TAG, "Transfer rate: " + transferRate + " KB/s");
      } 
      catch (NumberFormatException e)
      {
         // Cannot parse string.
       }
     }
   }
  }
  </code></pre>
  
  <p>Suggest me where I am doing wrong.</p>