Reputation: 1593
I have downloaded the sample code from this site for FTP Client http://www.lysesoft.com/products/andftp/index.html
But when I ran the project I got this exception and crashed.
03-27 21:40:44.572: INFO/System.out(559): EEE : No Activity found to handle Intent { act=android.intent.action.PICK dat=ftp://192.168.20.128 typ=vnd.android.cursor.dir/lysesoft.andftp.uri (has extras) }
What is the reason for this? Can anyone provide me a fully working android code for FTP.
This is the code for downloading.
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("ftp://192.168.20.128");
intent.setDataAndType(ftpUri, "vnd.android.cursor.dir/lysesoft.andftp.uri");
// Download
intent.putExtra("command_type", "download");
// FTP credentials (optional)
intent.putExtra("ftp_username", "anonymous");
intent.putExtra("ftp_password", "[email protected]");
//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", "/remotefolder/subfolder/file1.zip");
intent.putExtra("remote_file2", "/remotefolder/subfolder/file2.zip");
// Target local folder where files will be downloaded.
intent.putExtra("local_folder", "/sdcard/localfolder");
intent.putExtra("close_ui", "true");
startActivityForResult(intent, DOWNLOAD_FILES_REQUEST);
I get error at "startActivityForResult"
Upvotes: 1
Views: 947
Reputation: 81
First of all you have to define your activity in AndroidManifest.xml file. If you are using any activity which is working in your android application you have to define in AndroidManifest.xml file.
Upvotes: 0
Reputation: 200080
Man, you need to install AndFTP in order to be able to work with FTP (unless you implement the FTP functionality by your self).
Let me guess what you did: you thought that by implementing the snippets of code that you found in the andFtp website you were going to be able to use FTP in your application.
If I guessed right, then you do not understand completely how Android works and what you have to do in order to use FTP. So, what andFTP does is register offer some activities that can be used by external apps in order to use FTP. However, in order for it to work the andFTP application must be installed.
That's why you get an ActivityNotFound
exception. So here are your only two choices:
Upvotes: 3
Reputation: 1355
Did you check that activity is listed in the android manifest? It would cause that kind of error.
Upvotes: 0