这是 MainActivity.Java。这个函数我想在另一个类中调用
// 连接FTP服务器的方法:
public static boolean ftpConnect(String host, String username,
String password, int port) {
try {
mFTPClient = new FTPClient();
mFTPClient.connect(host, port);
if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
boolean status = mFTPClient.login(username, password);
mFTPClient.enterLocalPassiveMode();
mFTPClient
.setFileTransferMode(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
return status;
}
} catch (Exception e) {
Log.d(TAG, "Error: could not connect to host " + host);
}
return false;
}