Valten1992
Newbie
Huzzah! My first problem post!(not sure if that is a good thing or a bad thing.....
)
A problem that has been frustrating me for the last few days is downloading from an FTP for my Android app. Up till now, the app has been reading from local files to get its data but the final version shall read the files on a FTP server. The problem is that while the experiment app I made can connect to the server, downloading seems to not work. No file is downloaded at all, knowing me Im probably missing something obvious.
My onCreate
Names hidden to protect identity 
And the download method
Unrelated, but how exactly do you make your own custom logs to display errors? I've been using toasts up until now. I try Log.e("Error", e.getMessage()) but it does not display.
)A problem that has been frustrating me for the last few days is downloading from an FTP for my Android app. Up till now, the app has been reading from local files to get its data but the final version shall read the files on a FTP server. The problem is that while the experiment app I made can connect to the server, downloading seems to not work. No file is downloaded at all, knowing me Im probably missing something obvious.
My onCreate
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ftpConnect("domain","username", "password", portnum);
try
{
String s = Environment.getExternalStorageDirectory().toString();
File f = new File(s+"/???/item");
f.mkdirs();
ftpDownload("ftp://user@portalftp.?????.com/rooms.txt", f);
}
catch(Exception e)
{
Toast toast = Toast.makeText(getApplicationContext(), "Download error: "+e.getMessage(), Toast.LENGTH_SHORT);
toast.show();
}
ftpDisconnect();
}

And the download method
Code:
public boolean ftpDownload(String srcFilePath, File desFilePath)
{
boolean status = false;
try {
FileOutputStream desFileStream = new FileOutputStream(desFilePath);
status = mFTPClient.retrieveFile(srcFilePath, desFileStream);
desFileStream.close();
Toast toast = Toast.makeText(getApplicationContext(), "Downloaded", Toast.LENGTH_SHORT);
toast.show();
return status;
} catch (Exception e) {
Toast toast = Toast.makeText(getApplicationContext(), "Download error"+e.getMessage(), Toast.LENGTH_SHORT);
toast.show();
}
return status;
}
