问题描述
连接到FTP服务器时出现以下错误。
我/编舞:跳过了63帧!该应用程序可能在其主线程上做过多的工作。
我希望我的Android应用程序读取FTP服务器上的所有当前文件并重命名现有文件。
这是MainActivity
代码:
public class MainActivity extends AppCompatActivity {
public FtpConnection ftpp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ftpp=new FtpConnection(this);
final TextView textView=(TextView)findViewById(R.id.textView);
Button button=(Button)findViewById(R.id.btn);
button.setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean result= ftpConnect();
if (result==false)
{
textView.setText("connected");
}
else
{
textView.setText("Not connected");
}
}
});
}
private static final String TAG = "Ftp Connection";
public boolean ftpConnect( )
{
String host = "ftp.drivehq.com";
String username ="hrharry20";
String password ="**********";
int port =21;
try {
FTPClient mFTPClient = new FTPClient();
mFTPClient.connect(host,port);
boolean status = mFTPClient.login(username,password);
String oldFile = "//GroupWrite//Tally//dih.txt";
String newFile = "//GroupWrite//Tally//dinesh.txt";
boolean success = mFTPClient.rename(oldFile,newFile);
if (success) {
Log.d("rename msg",oldFile + " was successfully renamed to: "
+ newFile );
} else {
Log.d("@R_404_4761@ to rename:","dont"+oldFile );
}
mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
mFTPClient.enterLocalPassiveMode();
return true;//status;
} catch(Exception e) {
Log.d("connection msg","Error: Could not connect to host " + host );
}
return false;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)