关于android下实现FTP多线程下载的功能 android下能否实现ftp多线程现在的功能呢?研究中发现一个文件进行多线程下载有一定的难度,有没有做过的哥们,指点一下。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 了解一下AsyncTaskpublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.pd = ProgressDialog.show(this, "Working...", "*** Downloading Data...", true, false); new DownloadTask().execute(" parameters needed for download");}private class DownloadTask extends AsyncTask<String, Void, Object> { protected Void doInBackground(String... args) { //Background thread starting...... startLongRunningOperation(); return null; } protected void onPostExecute(Object result) { if (Splash.this.pd != null) { Splash.this.pd.dismiss(); } updateResultsInUi(); }} protected void startLongRunningOperation() { try { ftp = new FTPClient(); ftp.connect(host); ftp.login("username", "password"); ftp.changeDirectory("public_ftp"); ftp.download("test.txt", new java.io.File("/sdcard/test.txt")); } catch(Exception e) { }} 你应该是不太了解ftp下载的东西,算了,结贴! android 如何实现对view的放大和缩小 音乐显示播放进度问题 使用TranslateAnimation播放动画时留下痕迹如何解决 android哪个函数是获取当前app的安装目录的 定时发送消息广播没有收到消息,什么情况- - touchkit电阻屏调试【求助】 模拟器运行正常,真机测试出错 HttpClient 报错求助 service怎么才能在系统休眠后不被杀掉? myeclipse8.5安装adt插件一直就在准备,dandan都碎掉了…… [ffmpeg]如何同时解码多路视频 android 调用JAX-WS构造的webservice问题
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); this.pd = ProgressDialog.show(this, "Working...", "*** Downloading Data...", true, false);
new DownloadTask().execute(" parameters needed for download");
}private class DownloadTask extends AsyncTask<String, Void, Object> {
protected Void doInBackground(String... args) {
//Background thread starting......
startLongRunningOperation();
return null;
} protected void onPostExecute(Object result) { if (Splash.this.pd != null) {
Splash.this.pd.dismiss();
}
updateResultsInUi(); }
}
protected void startLongRunningOperation() {
try
{
ftp = new FTPClient();
ftp.connect(host);
ftp.login("username", "password");
ftp.changeDirectory("public_ftp");
ftp.download("test.txt", new java.io.File("/sdcard/test.txt"));
}
catch(Exception e)
{ }
}